SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2012
    Location
    Tucson, AZ
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery Dropdown Effects only on Mobile?

    Currently, I have my mobile navigation set up to create a dropdown function. You can see a working example here (just pull you browser small to see the mobile nav):
    http://goo.gl/TzPPd

    The problem is that the jQuery drop down effects are also being applied to the non-mobile navigation, which is causing some issues. I want the jQuery effects to only work on the mobile navigation, here is the code I'm currently using:

    Code:
        $(function() {
          $('ul.menu > li > a').click(function(e) {
            $('ul.sub-menu').slideUp('normal');
              if($(this).next('ul.sub-menu').is(':hidden') === true) {    
                $(this).next('ul.sub-menu').slideDown('normal');
              }
           e.preventDefault();
          });
        });
    I tried this, but had no luck:

    Code:
        $(function() {
          $('#main-nav_responsive > ul.menu > li > a').click(function(e) {
            $('#main-nav_responsive > ul.sub-menu').slideUp('normal');
              if($(this).next('#main-nav_responsive > ul.sub-menu').is(':hidden') === true) {    
                $(this).next('#main-nav_responsive > ul.sub-menu').slideDown('normal');
              }
            e.preventDefault();
          });
        });
    Anyone know how to make the jQuery effects only apply to the mobile navigation?

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    From what I can see on your sample link this is working as intended? Did you end up fixing it or am I missing something?
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


Bookmarks

Posting Permissions

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