MarkHughes88
MarkHughes88

Reputation: 669

Clashing jQuery Plugins

I'm building a website and I have used a jQuery widget plugin to display a certain div when a link is selected. However in order for this to work it requires the "jquery-1.2.6.min.js" plugin to work.

However the framework for the site is built using bootstrap and I also wanted to include a slick slider which both require "jquery-1.11.0.min.js" to work. These are obviously clashing and preventing each other from operating.

I'm not familiar with jQuery so I was wondering if there was a work around for this or a better solution to solve the issue or whether I need to find another widget plugin to display the divs.

Upvotes: 2

Views: 72

Answers (1)

David R.
David R.

Reputation: 684

If updating/replacing the older code isn't possible, you can run multiple versions of jQuery simultaneously using noConflict:

<!-- load jQuery 1.2.6 -->
<script type="text/javascript" src="http://example.com/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
var jQuery_1_2_6 = $.noConflict(true);
</script>

<!-- load jQuery 1.11.0 -->
<script type="text/javascript" src="http://example.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
var jQuery_1_11_0 = $.noConflict(true);
</script>

...Then just pass in the particular version you want.

Upvotes: 1

Related Questions