(function($) { $.fn.menu = function(b) { var c, item, httpAdress; b = jQuery.extend({ Speed: 220, autostart: 1, autohide: 1 }, b); c = $(this); item = c.children("ul").parent("li").children("span"); httpAdress = window.location; item.addClass("inactive"); function _item() { var span = $(this); if (b.autohide) { span.parent().parent().find(".active").parent("li").children("ul").slideUp(b.Speed / 1.2, function() { $(this).parent("li").children("span").removeAttr("class"); $(this).parent("li").children("span").attr("class", "inactive") }) } if (span.attr("class") == "inactive") { span.parent("li").children("ul").slideDown(b.Speed, function() { span.removeAttr("class"); span.addClass("active") }) } if (span.attr("class") == "active") { span.removeAttr("class"); span.addClass("inactive"); span.parent("li").children("ul").slideUp(b.Speed) } } item.unbind('click').click(_item); if (b.autostart) { c.children("span").each(function() { if (this.href == httpAdress) { $(this).parent("li").parent("ul").slideDown(b.Speed, function() { $(this).parent("li").children(".inactive").removeAttr("class"); $(this).parent("li").children("span").addClass("active") }) } }) } } })(jQuery); (function($) { $.fn.menu2 = function(b2) { var c2, item, httpAdress; b2 = jQuery.extend({ Speed: 220, autostart: 1, autohide: 1 }, b2); c2 = $(this); item = c2.children("dl").parent("dd").children("i"); httpAdress = window.location; item.addClass("active2"); function _item() { var i = $(this); if (b2.autohide) { i.parent().parent().find(".active2").parent("dd").children("dl").slideUp(b2.Speed / 1.2, function() { $(this).parent("dd").children("i").removeAttr("class"); $(this).parent("dd").children("i").attr("class", "inactive2") }) } if (i.attr("class") == "inactive2") { i.parent("dd").children("dl").slideDown(b2.Speed, function() { i.removeAttr("class"); i.addClass("active2") }) } if (i.attr("class") == "active2") { i.removeAttr("class"); i.addClass("inactive2"); i.parent("dd").children("dl").slideUp(b2.Speed) } } item.unbind('click').click(_item); if (b2.autostart) { c2.children("i").each(function() { if (this.href == httpAdress) { $(this).parent("dd").parent("dl").slideDown(b2.Speed, function() { $(this).parent("dd").children(".inactive2").removeAttr("class"); $(this).parent("dd").children("i").addClass("active2") }) } }) } } })(jQuery);