简体   繁体   中英

age old dilema to have multiple versions of jquery on a page not conflict?

so I keep running into the same issue, and I've tried reading through many solutions but can't seem to find something that works. Essentially, I need to know of an easyish way to have it so my web page can load 2 different versions of jquery without conflicting... I know people keep recommending the "jquery noconflict" script, but I can't seeem to get that to work.

I have a 3d carousel that is using jquery 1.7, another thing below that is using 1.6, and a fader that uses 1.9.

Can someone please explain how I can get these all to play nicely on my web page?

Any input at all would be greatly appreciated.

Thanks

If you want to use several versions of jquery on the same page, you could try to do something like this (not tested though)

<script src="jquery-1.6">
<script>
 $16=$
 $.noConflict();
</script>

<script src="jquery-1.9">
<script>
 $19=$
 $.noConflict();
</script>

<script>
  $16(document).ready(function($) {
    // now $ references to jquery 1.6
  })

  $19(document).ready(function($) {
    // now $ references to jquery 1.9
  })
</script>

as George Yates says, you should try to use only one version of jQuery, as more are too much overhead for the network.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM