Clashing JQuery

Discussion in 'Scripts' started by TheHive, Jan 12, 2012.

to remove all ads.
  1. TheHive

    TheHive New Member

    Messages:
    4
    Hey guys,

    I have a problem I'm trying to run 2 JQuery functions on my site:
    1. Nivo slideshow
    2. Show and Hide

    Both scripts run perfectly on their own but when I add the both to xhtml only the slideshow runs.

    Both scripts are below as in my code (any help greatly appreciated):


    <!--JQUERY_SHOW_&_HIDE----------------------------------------------------------------------------------------->

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
    <script src="showHide.js" type="text/javascript"></script>
    <script type="text/javascript">

    $(document).ready(function(){


    $('.show_hide').showHide({
    speed: 1000, // speed you want the toggle to happen
    easing: '', // the animation effect you want. Remove this line if you dont want an effect and if you haven't included jQuery UI
    changeText: 0, // if you dont want the button text to change, set this to 0
    showText: 'View',// the button text to show when a div is closed
    hideText: 'Close' // the button text to show when a div is open

    });


    });

    </script>

    <!--JQUERY_SHOW_&_HIDE_END--------------------------------------------------------------------------------------->

    <!--JQUERY_SLIDESHOW--------------------------------------------------------------------------------------------->

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
    02
    <script type="text/javascript">
    03

    04
    $(document).ready(function(){
    05

    06
    $(".slidingDiv").hide();
    07
    $(".show_hide").show();
    08

    09
    $('.show_hide').click(function(){
    10
    $(".slidingDiv").slideToggle();
    11
    });
    12

    13
    });
    14

    15
    </script>

    <script type="text/javascript" src="jquery-1.6.1.min.js"></script>
    <script type="text/javascript" src="jquery.nivo.slider.pack.js"></script>
    <script type="text/javascript">
    $(window).load(function() {
    $('#slider').nivoSlider();
    });
    </script>
    <!--JQUERY_SLIDESHOW_END--------------------------------------------------------------------------------------------->
     
  2. conor

    conor New Member

    Messages:
    348
    It could have something to do with the fact that your loading 3 different versions of jQuery at once. Remove these lines:

    Code:
    <script type="text/javascript" src="jquery-1.6.1.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
    leave the call to load 1.6.4 and it should work
     
  3. TheHive

    TheHive New Member

    Messages:
    4
    Hey Conor,

    Makes perfect sense.

    Thanks mate!
     

Share This Page