0

first of all I see this question and use noConflict:

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

But what I want is to load 2 jquery plugins (superfish.js and jstree) and each use different version of jquery (in their core library I mean), How can I do this?

edit: I put what I done so far and what I want:

<script type="text/javascript" src="http://example.com/jquery-1.7.js"></script>                
// i do not use noConflict for support other plugins 

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

Now for example I want to load superfish.js to use jquery_1_9:

<script  type="text/javascript" src="http://example.com/superfish.js">   </script>

superfish.js use $ and it refer to jquery version 1.7

Community
  • 1
  • 1
mohsenJsh
  • 2,048
  • 3
  • 25
  • 49

1 Answers1

0

If js file 'superfish.js' loading from local assets then by providing wrapper to init (main function or entry point of function) function of this file we can solve it.

<script>
var jQuery_1_9 = $.noConflict(true);
initailizeFun(jQuery_1_9); // inside function of superfish.js which initiates plugin.
</script>

But problem here is if are using another version of jquery like 'jQuery_1_8' then setting user data to this 'jQuery_1_8' will not be accessible in superfish.js.

santy
  • 310
  • 1
  • 9