dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Multiple jQuery on same page/no conflict

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Location
    Earth
    Posts
    198

    resolved [RESOLVED] Multiple jQuery on same page/no conflict

    I have a page that will have a jquery photo gallery and a juqery slider among other things. The menu also will use jQuery.
    For menu, I have a code resembling this:
    $('.navbar li a').click(function() {
    target = $(this).attr('data-target');
    $('html, body').animate({
    scrollTop: $(target).offset().top
    }, 800);
    });

    and then I thought of using easyslider for the photo gallery:
    $(document).ready(function(){
    $("#slider").easySlider({
    auto: true,
    continuous: true
    });
    });

    but now the slider works, not the menu. Search sent me to do this:
    var $j = jQuery.noConflict();

    $j(document).ready(function(){
    $j("#slider").easySlider({
    auto: true,
    continuous: true
    });
    });

    I've called the jquery.js file only once and all the js code is in the same html file instead of creating a separate .js file for it.
    but still the menu doesn't work. I can't seem to understand how to have all jQuery items working. Please help.

  2. #2
    Join Date
    Oct 2013
    Posts
    25
    You should wrap your code in the [code] bracket so it will be easier for people to read.

    Also, what does the rest of the file look like?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles