WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Jquery conflict - how to solve? (3 posts)

  1. matthisco
    Member
    Posted 1 year ago #

    Can someone please tell me how I can get these two plugins to work on the same page please?

    My code below generates the errors:

    Code:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="http://www.mharrisweb.co.uk/wp-content/themes/skeleton/javascripts/responsiveslides.min.js"></script>
    
    <script type="text/javascript">
    var jQuery_1_8_2 = $.noConflict(true);
    </script>
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://www.mharrisweb.co.uk/wp-content/themes/skeleton/javascripts/jquery.capty.min.js"></script>
    
    <script type="text/javascript">
    var jQuery_1_5_2 = $.noConflict(true);
    </script>
    <script>
    $jQuery_1_5_2(document).ready(function(){
    
        $jQuery_1_5_2('#default').capty();
    
    });
    </script>
    
       <script>
    $jQuery_1_8_2(document).ready(function(){
    
       // Slideshow 1
          $jQuery_1_8_2("#slider1").responsiveSlides({
            maxwidth: 800,
            speed: 800
    
          });
    
    });
    </script>

    Errors:
    Timestamp: 07/11/2012 15:34:28
    Error: ReferenceError: $jQuery_1_5_2 is not defined
    Source File: file:///C:/Documents%20and%20Settings/harrisma/Desktop/ResponsiveSlides.js-master/ResponsiveSlides.js-master/demo/demo.html
    Line: 28

    Timestamp: 07/11/2012 15:34:28
    Error: ReferenceError: $jQuery_1_8_2 is not defined
    Source File: file:///C:/Documents%20and%20Settings/harrisma/Desktop/ResponsiveSlides.js-master/ResponsiveSlides.js-master/demo/demo.html
    Line: 38

  2. Rachel Baker
    Member
    Posted 1 year ago #

    1. why are you loading jQuery 1.8.2 AND 1.5.2?

    2. You don't really to declare a variable for noConflict, but if you want to you should try:

    var jQuery_1_8_2 = $.noConflict();

    3. A better method would be:

    jQuery(document).ready(function($) {
        // Code that uses jQuery's $ can follow here.
      });

    http://api.jquery.com/jQuery.noConflict/
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers

  3. matthisco
    Member
    Posted 1 year ago #

    Thanks very much for your reply.

    I can't get both to work with 1.8.2. I get lots of errors.

    Can you please tell me how I can get them both working?

    Here is my page:

    http://www.mharrisweb.co.uk/demo.html

    Many, many thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic