- 浏览: 172511 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (174)
- rails (25)
- js (15)
- ruby (30)
- webserver (5)
- mysql (13)
- security (5)
- thinking (5)
- common sense (2)
- linux (18)
- android (26)
- web browser (1)
- config and deploy (1)
- mac (5)
- css (2)
- db (8)
- version manager (1)
- editor (1)
- job (1)
- OOA (1)
- php (1)
- apache (2)
- mongrel (1)
- Mongodb (1)
- facebook (1)
- 架构 (1)
- 高并发 (1)
- twitter (1)
- Erlang (1)
- Scala (1)
- Lua (1)
- ubuntu (3)
- cache (1)
- 面试题 (2)
- android layout (2)
- android控件属性 (2)
- java (5)
- customize view (1)
- advanced (2)
- python (2)
- 机器学习 (5)
最新评论
之前的项目用的是prototype ,许多功能是用prototype实现的
In the jQuery core code (which includes ajax, animations, et al.) there is a method called jQuery(). The $() method is aliased for the jQuery() in the code. This means that all you have to do is remove the part of jQuery that alias the $() method. In jQuery 1.0.4 uncompressed the lines you need to comment out start at line 60: Change: To: Once this is done, jQuery will no longer interfere with Prototype. You will have to use the jQuery() method to create a jQuery object, unless you alias the method to something else. I alias it to jq like this: yessss Change: To: One last thing:
Although all of the core uses JQuery() internally, there is no guaranty that any plugin will do the same, in my experience none do. The solution that works for me is to do a find/replace in the downloaded plugin, replacing any $( with jQuery(. That's it. Now you can easily use jQuery and prototype in your rails app, even in the same view. I regularly use inline
edit (which produces Prototype code) and jQuery in the same view, no problems.
现在项目要使用jquery,就必须混用
也可以只用jquery
There is a problem with using them together though: Prototype came up with this nice function called $() which is slightly more than a shortcut to document.getElementById(). This function is the main function in Prototype. Well,
John Resig
, the creator of jQuery, also used to be a Prototype fan, so the main method in jQuery is also called $(). The jQuery website says that all you have to do to get them to play nice is to include jQuery after you include Prototype. Unfortunately, this is not enough. There is just a little bit more you have to do:// Map over the $ in case of overwrite
if ( typeof $ != "undefined" )
jQuery._$ = $;
// Map the jQuery namespace to the '$' one
var $ = jQuery;// Map over the $ in case of overwrite
//if ( typeof $ != "undefined" )
//jQuery._$ = $;
// Map the jQuery namespace to the '$' one
//var $ = jQuery;var $ = jQuery;
var jq = jQuery;
发表评论
-
7点关于RESTful规范的API接口设计的想法
2016-11-28 14:29 941转:https://segmentfault.co ... -
RESTful API 设计指南
2016-11-28 14:17 405转:http://www.ruanyifeng.com/bl ... -
rails笔记
2016-11-28 13:55 641电子商务系统restful API问卷调查系统考试系统文档 ... -
重构臃肿 ActiveRecord 模型的 7 种方式
2016-11-19 16:29 552转:http://ruby-china.org/topics ... -
Rails系统重构:从单一复杂系统到多个小应用集群
2016-11-17 22:32 435转:http://www.infoq.com/cn/arti ... -
Custom dialog for data-confirm in Rails
2016-10-11 17:24 815Every Rails developers might ... -
常用ruby gem
2016-10-01 12:34 1118常见gems:Devise用于快 ... -
sphinx-0.99 + ultrasphinx
2016-07-27 20:20 472一、Installing Sphinx 1.Extra ... -
rails3 simple captcha
2015-06-03 16:06 634安装: ruby script/plugin insta ... -
测试ruby代码高亮
2015-05-27 16:33 534# encoding: utf-8 require 'd ... -
rails3 time zone
2015-01-04 20:07 507什么是Time Zone,就是时区,UTC或者是GMT ... -
Creating a 100% ajax CRUD using rails 3 and unobtrusive javascript
2014-12-29 22:29 723Creating the project and ... -
rails render用法
2014-12-29 18:55 971render :action => "sho ... -
Rails 3.2 的 Ajax 向导
2014-12-29 18:50 461原文: http://chloerei.com/2012/0 ... -
ror websites
2014-03-04 11:29 530http://railscasts.com/ ht ... -
OAuth gem for rails3
2012-05-21 23:24 795OAuth gem for rails,支持豆瓣,新浪微 ... -
识别验证码
2011-11-18 17:20 1104用imagemagick和tesseract-ocr破解简单 ... -
rails env
2011-04-08 19:41 14231.apt-get安装ruby: ~$ sudo apt-g ... -
搭建rails开发环境
2011-04-08 19:35 955http://www.netbeans.org/ NetB ... -
fragment cache
2011-03-30 01:30 8761.hold the current frament in a ...
相关推荐
jRails是一个替代 Rails 中的Prototype/script.aculo.us 为 jQuery 的项目。使用 jRails,你能获得所有缺省的Rails helpers 来使用jQuery库。 安装方法: ./script/plugin install ...
以前做界面是用jquery的,现在因为要用许多ajax效果,改用了rails自带的prototype 因为jquery用多了,换个框架也大同小异,不过细节上有很多不同。。。 1.dom加载方面: jquery有dom ready方法,推迟js函数的绑定...
用 jQuery 替代Prototype/script.aculo.us 在Rails做 helpers 实现 javascript 的功能,jQuery library的优点: 快速简洁优雅. 也支持JQuery与Prototypea共存,方法如下: 1、将jquery.js放到prototype.js后面(这个...
它通过jQuery或Prototype以一种毫不干扰的方式做到这一点。 此gem仅适用于 。有关可在Rails 2中使用的插件,请参见。 可以在找到示例项目,该示例如何工作。 设置 将其添加到您的Gemfile中,然后运行bundle进行...
要求轨道 3.1+ 主要的 JavaScript 库(JQuery、Prototype 等)必须包含在 selectivizr 包含标记之前。贡献这个 repo 应该没什么关系,但是如果你想改进代码或做一个版本提升,只需 fork 代码并提交拉取请求。 我尝试...
Flot - Flot 为 jQuery 提供的javascript代码库. 容易使用,有特色的图表,提供交互功能(能够放大缩小数据区域等)。 Open Flash Chart - Open Flash Chart 是一个 Flash 图表组件,很容易安装,提供以下语言的API...
Flot - Flot 为 jQuery 提供的javascript代码库. 容易使用,有特色的图表,提供交互功能(能够放大缩小数据区域等)。 Open Flash Chart - Open Flash Chart 是一个 Flash 图表组件,很容易安装,提供以下语言的API...
KO和jQuery (或Prototype等)是竞争关系还是能一起使用? 所有人都喜欢jQuery! 它是一个在页面里操作元素和事件的框架,非常出色并且易使用,在DOM操作上肯定使用jQuery,KO解决不同的问题。 Everyone loves jQuery!...
分配列表可以在Prototype或jQuery下工作。 请参阅安装说明。 分配列表适用于带有或不带有rails_xss的Rails 2.3.8。安装 安装插件: script/plugin install http://github.com/leikind/wice_assignment_lists.git ...
Dash Lua Marionette.js Meteor MongoDB Mongoose Mono MooTools MySQL Nginx Node.js OCaml OpenCV OpenGL Perl PhoneGap PHP Play Framework PostgreSQL Processing.org Prototype Puppet Python Qt R Redis Ruby ...
*支持流行AJAX框架的Code Assist功能:AFLAX,Dojo,JQuery,MochiKit,Prototype,Rico,script.aculo.us,Yahoo UI。 其主页上还提供如何使用该开发工具的视频。 Aptana是一个基于Eclipse的集成开发环境,其最...