Is there a way to use bootstrap 3.0 plugins with jQuery.noConflict()?

后端 未结 3 1268
花落未央
花落未央 2021-02-04 06:56

We are currently loading 2 different versions of jQuery on our page, 1.4.2 and 1.10.1. The $ and window.jQuery objects are currently pointing to 1.4.2.

We are using no

3条回答
  •  遇见更好的自我
    2021-02-04 07:36

    If you load the bootstrap JS straight after loading jQuery version 1.10.1 and then put jQuery into no conflict mode, it should work.

    e.g.:

    
    
    
    
    
    
    
    

    jQuery.noConflict(true) will reassign both $ and jQuery to their previous values so it doesn't matter if version 1.4.2 is loaded first or not.

    It does mean your users will be downloading jQuery twice though and you will need to remember if to use $jq1 or $ when doing anything with jQuery.

提交回复
热议问题