﻿/*!
* Droppy 0.1.2
* Copyright 2008 Jason Frame (jason@onehackoranother.com)
*/
$.fn.droppy = function (a) { a = $.extend({ speed: 200 }, a || {}); var b = (Modernizr && Modernizr.touch) || (navigator.userAgent.toLowerCase().search("windows phone os 7") > -1); this.each(function () { var d = this, j = 1000; function h(l) { if (l.nodeName.toLowerCase() == "li") { var k = $("> ul", l); return k.length ? k[0] : null } else { return l } } function f(k) { if (k.nodeName.toLowerCase() == "ul") { return $(k).parents("li")[0] } else { return k } } function e(k) { return $("> a", k).attr("href") || "#" } function g(k) { if (b) { window.location = e(this); return } var l = h(this); if (!l) { return } $.data(l, "cancelHide", false); setTimeout(function () { if (!$.data(l, "cancelHide")) { $(l).slideUp(a.speed) } }, 400) } function c(l) { var k = this; if (b && k.nodeName.toLowerCase() == "li" && $("> ul", k).length === 0) { window.location = e(this); return } var m = h(k); if (!m) { return } $("> li > ul", d).not(m).stop(true, true).hide(); $.data(m, "cancelHide", true); setTimeout(function () { if ($.data(m, "cancelHide")) { $(m).css({ zIndex: j++ }).slideDown(a.speed); if (k.nodeName.toLowerCase() == "ul") { var n = f(k); $(n).addClass("hover"); $("> a", n).addClass("hover") } } }, 300) } var i = $("li", this); if (!b) { $("ul, li", this).hover(c, g) } else { i.toggle(c, g) } i.hover(function () { $(this).addClass("hover"); $("> a", this).addClass("hover") }, function () { $(this).removeClass("hover"); $("> a", this).removeClass("hover") }) }) };
