1/* 2 * Droppy 0.1.2 3 * (c) 2008 Jason Frame ([email protected]) 4 */ 5(function($){ 6 $.fn.droppy = function(options) { 7 8 options = $.extend({speed: 250}, options || {}); 9 10 this.each(function() { 11 12 var root = this, zIndex = 1000; 13 14 function getSubnav(ele) { 15 if (ele.nodeName.toLowerCase() == 'li') { 16 var subnav = $('> ul', ele); 17 return subnav.length ? subnav[0] : null; 18 } else { 19 return ele; 20 } 21 } 22 23 function getActuator(ele) { 24 if (ele.nodeName.toLowerCase() == 'ul') { 25 return $(ele).parents('li')[0]; 26 } else { 27 return ele; 28 } 29 } 30 31 function hide() { 32 var subnav = getSubnav(this); 33 if (!subnav) return; 34 $.data(subnav, 'cancelHide', false); 35 setTimeout(function() { 36 if (!$.data(subnav, 'cancelHide')) { 37 $(subnav).slideUp(options.speed); 38 } 39 }, 500); 40 } 41 42 function show() { 43 var subnav = getSubnav(this); 44 if (!subnav) return; 45 $.data(subnav, 'cancelHide', true); 46 $(subnav).css({zIndex: zIndex++}).slideDown(options.speed); 47 if (this.nodeName.toLowerCase() == 'ul') { 48 var li = getActuator(this); 49 $(li).addClass('hover'); 50 $('> a', li).addClass('hover'); 51 } 52 } 53 54 $('ul, li', this).hover(show, hide); 55 $('li', this).hover( 56 function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); }, 57 function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); } 58 ); 59 60 }); 61 62 }; 63})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.