Return to Snippet

Revision: 55242
at July 11, 2013 16:25 by thewickedchemist


Updated Code
function dropdown_menu() {
  $("#sub-menu-id a, .subnav a");
  $(" #sub-menu-id ").css({
    display: "none",
    opacity: "1"
  }); // fix for opera browser
  $("#sub-menu-id li").each(function () {
    var $subNav = jQuery(this).find('ul:first');
    $(this).hover(function () {
      $subNav.stop().css({
        overflow: "hidden",
        height: "auto",
        display: "none"
      }).slideDown(350, function () {
        $(this).css({
          overflow: "visible",
          height: "auto"
        });
      });
    }, function () {
      $subNav.stop().slideUp(350, function () {
        $(this).css({
          overflow: "hidden",
          display: "none"
        });
      });
    });
  });
}


//USAGE  
<script>
  jQuery(document).ready(function () {
    dropdown_menu();
  }); 
</script>

Revision: 55241
at January 31, 2012 10:46 by thewickedchemist


Updated Code
function dropdown_menu() {
    $("#sub-menu-id a, .subnav a");
    $(" #sub-menu-id ").css({
        display: "none",
        opacity: "1"
    }); // fix for opera browser
    $("#sub-menu-id li").each(function() {
        var $subNav = jQuery(this).find('ul:first');
        $(this).hover(function() {
            $subNav.stop().css({
                overflow: "hidden",
                height: "auto",
                display: "none"
            }).slideDown(350, function() {
                $(this).css({
                    overflow: "visible",
                    height: "auto"
                });
            });
        }, function() {
            $subNav.stop().slideUp(350, function() {
                $(this).css({
                    overflow: "hidden",
                    display: "none"
                });
            });
        });
    });
}


//USAGE  
<script>
jQuery(document).ready(function(){ dropdown_menu(); });
</script>

Revision: 55240
at January 31, 2012 10:37 by thewickedchemist


Initial Code
function dropdown_menu() {
    $("#navigation a, .subnav a");
    $(" #navigation ul ").css({
        display: "none",
        opacity: "1"
    }); // fix for opera browser
    $("#navigation li").each(function() {
        var $subNav = jQuery(this).find('ul:first');
        $(this).hover(function() {
            $subNav.stop().css({
                overflow: "hidden",
                height: "auto",
                display: "none"
            }).slideDown(350, function() {
                $(this).css({
                    overflow: "visible",
                    height: "auto"
                });
            });
        }, function() {
            $subNav.stop().slideUp(350, function() {
                $(this).css({
                    overflow: "hidden",
                    display: "none"
                });
            });
        });
    });
}

Initial URL
http://www.design-ninja.net

Initial Description
Simple solution to add dropdowns quickly to any site.

Initial Title
JQuery Sub-Menu Function

Initial Tags
jquery

Initial Language
jQuery