Furry
Furry

Reputation: 345

Using multiple jquery version libraries

I have a slider and a navigation bar, both requires the use of different jquery version.

The slider uses 1.7.2 while the navigation uses 1.4.2

    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>


    <script type="text/javascript" src="js/jquery-1.4.2.js"></script>
    <script type="text/javascript">
    var $jq = $.noConflict(true);
    </script>

<!-- NAVIGATION -->
    <script type="text/javascript">
    $jq(document).ready(function() {
        $jq('#main-image-box').children().removeClass('facets').end().facets({
            control: 'ul#mainlevel',
            clipSpacing: 1,
            animationSpeed: 400,
            beforeMax: function(index) {
                $('#main-image-box .clip:eq('+index+') .container').show();
            },
            beforeMin: function(index) {
                $('#main-image-box .clip:eq('+index+') .container').hide();
            }
        });
    });
    </script>

<!-- SLIDER -->
    <script type="text/javascript" src="js/jquery.nivo.slider.js"></script>
        <script type="text/javascript">

       (window).load(function(){
            ('#slider').nivoSlider();
        });
        </script>

As you can see, I have tried using noconflict but it doesn't work, how do I solve this problem?

Upvotes: 1

Views: 210

Answers (2)

gdoron
gdoron

Reputation: 150253

<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script>
var $jVersion7 = $.noConflict(true);
</script>

<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type="text/javascript">
var $jVersion4 = $.noConflict(true);
</script>

Note that, if the navigation plugin you use MUST use jQuery 1.4.2 ONLY, it will be a good idea to choose a new plugin and dispose the old version.

jQuery has lots of plugins.

Upvotes: 0

Ariel
Ariel

Reputation: 26753

Does the navigation require 1.4.2?? I'd be surprised if it did.

So just get rid of that older version, and try it out.

Upvotes: 2

Related Questions