mmln
mmln

Reputation: 2114

jquery plugins working with different jquery versions

i got plugins using 3 different versions of jQuery on my site "1.7.1" "1.5.2" and "1.3.2". Got first 2 on my main page and theyre working just fine, but when i enter a site that uses the third one aswell, addons based on 1.7.1 and 1.5.2 stop working.

I did try adding jq132 = jQuery.noConflict(true); script, and then switching every $ in third app to jq132, but that doesnt seem to work. Any tips?

EDIT: i managed to cut out 1.5.2 and 1.3.2 versions, thanks for tips

Upvotes: 0

Views: 720

Answers (2)

daniel0mullins
daniel0mullins

Reputation: 1959

You could try editing each version of jQuery to change the namespace variable for each version if you really need all three versions (which you really don't, btw).

(function( window, undefined ) {

// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
    navigator = window.navigator,
    location = window.location;

var jQuery132 = (function() {

// Define a local copy of jQuery
var jQuery = function( selector, context ) {

and then in your $(document).ready():

jQuery132(document).ready(function($132) {
   // code goes here
});

and your $ would be replaced with $132 for your 1.3.2 version and so on.

Btw, this is a really bad idea.

Upvotes: 1

CodeJoust
CodeJoust

Reputation: 3790

What you're probably doing wrong is not calling $.noConflict right after including a version of jQuery. After every jQuery include tag, there needs to be <script> tag with $.noConflict for that version of jQuery.

See: Can I use multiple versions of jQuery on the same page?

Upvotes: 1

Related Questions