rthames62
rthames62

Reputation: 155

Implementing multiple jQuery plugins on one page

I am new to jquery and am trying to get multiple plugins to function on one page. Right now I am using an animated div slider that works on its own, and an animated link within page that works on its own. I can disable one and the other will work. I have already tried the $.noConflict(); but it just breaks both. Here is my code.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"        type="text/javascript"></script> 
<script src="js/jquery.localscroll.js" type="text/javascript"></script> 
<script src="js/jquery.scrollTo.js" type="text/javascript"></script> 

<link rel="stylesheet" type="text/css" media="screen" href="css/coda-slider.css">

<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery-ui-1.8.20.custom.min.js"></script>
<script src="js/jquery.coda-slider-3.0.js"></script>

<script>
  $(function() {
  $('#slider-id').codaSlider({
    dynamicTabsAlign: "left",
      dynamicArrows: true,
      autoSlide: true,
      slideEaseDuration: 1000,
      autoSlideInterval:8000,
      dynamicArrowsGraphical:true
  });
});

</script>

<script type="text/javascript">
$(document).ready(function() {
   $('#navcontact').localScroll({duration:800});
});
</script>

I have tried to use many of the other questions but cannot seem to get them to work.

Please help

Upvotes: 2

Views: 3534

Answers (1)

David Fritsch
David Fritsch

Reputation: 3731

Remove this line:

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

The jquery library should only be loaded once, no matter what version. If you load it again, any plugin added before it was added the last time won't be available.

Since you are loading both a version 1.4 and 1.7, you may want to move the above line to the top of the file and delete the call to <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" (which also isn't closed properly), since some of your plugins may require at least version 1.7.

Upvotes: 10

Related Questions