Prototype and jQuery together?

若如初见. 提交于 2019-12-08 01:30:27

问题


I noticed that a certain script I use relies on prototype. (Lightbox 2) Will it work together on the same page as jQuery? Is there way to make sure that they don;t conflict?


回答1:


There's a huge number of lightbox clones, why not choose a jQuery one? Regardless of avoiding conflicts between the libraries, having two JS libraries on one page is a lot to download.




回答2:


You can but you need to take special steps if you're using the $() special function. Basically it comes down to the order you call libraries and/or calling jQuery.noConflict().




回答3:


Use jQuery.noConflict so that you are required to make calls using the jQuery object explicitly (i.e. jQuery('#selector') instead of the $ alias.



来源:https://stackoverflow.com/questions/1997401/prototype-and-jquery-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!