Why does including prototype.js break the functioning of jquery bbq?

前端 未结 2 1620
攒了一身酷
攒了一身酷 2021-01-23 14:53

I have:

    



    




        
相关标签:
2条回答
  • 2021-01-23 15:12

    By including prototype.js after jQuery, Prototype will override the value of the global $ variable. You just need to use:

    var $j = jQuery.noConflict();
    

    You can then use $j in place of $ in jQuery contexts and $ for prototype contexts. Here's the documentation: http://api.jquery.com/jQuery.noConflict/.

    0 讨论(0)
  • 2021-01-23 15:23

    jQuery and Prototype both use the $ character so they will conflict.

    If you wish to use them both together you will need to make use of jQuery's noConflict() method to release the $ alias back to Protoype

    There is also a scrollTo jQuery plugin

    0 讨论(0)
提交回复
热议问题