1/* 2* Droppy 0.1.2 - modified by Max to add a function to disable when not undesired. 3* (c) 2008 Jason Frame ([email protected]) 4*/ 5 6var droppyDisableArray = new Array(); 7function droppyDisable(id) { 8 droppyDisableArray.push(id); 9} 10function dropppyDisable(id) { 11 console.warn('dropppyDisable with 3 ps!'); 12 droppyDisable(id); 13} 14 15(function() { 16 17 jQuery.fn.droppy = function(options) { 18 19 options = jQuery.extend({ speed: 250 }, options || {}); 20 21 this.each(function() { 22 // modified by Max for ignoring some menus menu 23 var id = $(this).attr("id"); 24 for (var i = 0; i < droppyDisableArray.length; i++) { 25 if (droppyDisableArray[i] == id) { 26 return; // ignoring droppy for this menu. 27 } 28 } 29 30 // ok. 31 var root = this, zIndex = 1000; 32 33 function getSubnav(ele) { 34 if (ele.nodeName.toLowerCase() == 'li') { 35 var subnav = $('> ul', ele); 36 return subnav.length ? subnav[0] : null; 37 } else { 38 return ele; 39 } 40 } 41 42 function getActuator(ele) { 43 if (ele.nodeName.toLowerCase() == 'ul') { 44 return $(ele).parents('li')[0]; 45 } else { 46 return ele; 47 } 48 } 49 50 function hide() { 51 var subnav = getSubnav(this); 52 if (!subnav) return; 53 $.data(subnav, 'cancelHide', false); 54 setTimeout(function() { 55 if (!$.data(subnav, 'cancelHide')) { 56 $(subnav).slideUp(options.speed); 57 } 58 }, 250); 59 } 60 61 function show() { 62 var subnav = getSubnav(this); 63 if (!subnav) return; 64 $.data(subnav, 'cancelHide', true); 65 $(subnav).css({ zIndex: zIndex++ }).slideDown(options.speed); 66 if (this.nodeName.toLowerCase() == 'ul') { 67 var li = getActuator(this); 68 $(li).addClass('hover'); 69 $('> a', li).addClass('hover'); 70 } 71 } 72 73 $('ul, li', this).hover(show, hide); 74 $('li', this).hover( 75 function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); }, 76 function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); } 77 ); 78 79 }); 80 81 82 83 }; 84 85})(); // execute the function immediately!
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.