﻿$.fn.droppy = function (a) { a = $.extend({ delay: 500, speed: 250 }, a || {}); this.each(function () { var c = this, g = 99999; function f(i) { if (i.nodeName.toLowerCase() == "li") { var h = $("> ul", i); return h.length ? h[0] : null } else { return i } } function d(h) { if (h.nodeName.toLowerCase() == "ul") { return $(h).parents("li")[0] } else { return h } } function e() { var h = f(this); if (!h) { return } $.data(h, "cancelHide", false); setTimeout(function () { if (!$.data(h, "cancelHide")) { $(h).slideUp(a.speed) } }, a.delay) } function b() { var i = f(this); if (!i) { return } $.data(i, "cancelHide", true); $(i).css({ zIndex: g++ }).slideDown(a.speed); if (this.nodeName.toLowerCase() == "ul") { var h = d(this); $(h).addClass("hover"); $("> a", h).addClass("hover") } } $("ul, li", this).hover(b, e); $("li", this).hover(function () { $(this).addClass("hover"); $("> a", this).addClass("hover") }, function () { $(this).removeClass("hover"); $("> a", this).removeClass("hover") }) }) };
