Bahadır Yılmaz
Bahadır Yılmaz

Reputation: 388

using no conflict with jquery

I need to use noconflict in my web site,but i think there is a problem.Here is my code :

calling... src="jquery-1.7.2.min.js" 
var jQuery_1_7_2 = jQuery.noConflict(true);

(function($){
    $(window).load(function () {
        $("#content_1").mCustomScrollbar({
            advanced:{
                updateOnContentResize: true
            },
            scrollButtons: {
                enable: true
            }                                          
        });
    });
})(jQuery_1_7_2);

Where am i wrong? Thanks.

Upvotes: 0

Views: 813

Answers (1)

Alnitak
Alnitak

Reputation: 339836

I note that you're using a plugin mCustomScrollbar in your code.

That plugin must be installed in the same jQuery instance as the one in use in your function so it must be loaded before you call .noConflict.

In practise you'll need something like this:

<script src="jquery-1.3.2.js"> </script>
<script src="module-needing-1.3.2"> </script>
<script>
   var jq132 = jQuery.noconflict(true);  // move jQuery 1.3.2 out of the way
</script>
<script src="jquery-1.7.2.js"> </script>
<script src="module-needing-1.7.2"> </script>
<script>
   var jq172 = jQuery.noconflict(false); // leave 1.7.2 as the default...
</script>

Upvotes: 1

Related Questions