1//** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com 2//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/ 3//** Menu created: Nov 12, 2008 4 5//** Dec 12th, 08" (v1.01): Fixed Shadow issue when multiple LIs within the same UL (level) contain sub menus: http://www.dynamicdrive.com/forums/showthread.php?t=39177&highlight=smooth 6 7//** Feb 11th, 09" (v1.02): The currently active main menu item (LI A) now gets a CSS class of ".selected", including sub menu items. 8 9//** May 1st, 09" (v1.3): 10//** 1) Now supports vertical (side bar) menu mode- set "orientation" to 'v' 11//** 2) In IE6, shadows are now always disabled 12 13//** July 27th, 09" (v1.31): Fixed bug so shadows can be disabled if desired. 14//** Feb 2nd, 10" (v1.4): Adds ability to specify delay before sub menus appear and disappear, respectively. See showhidedelay variable below 15 16//** Dec 17th, 10" (v1.5): Updated menu shadow to use CSS3 box shadows when the browser is FF3.5+, IE9+, Opera9.5+, or Safari3+/Chrome. Only .js file changed. 17//** July 17th, 11'- Updated to v 1.51: Menu updated to work properly in popular mobile devices such as iPad/iPhone and Android tablets. 18 19var ddsmoothmenu={ 20 21//Specify full URL to down and right arrow images (23 is padding-right added to top level LIs with drop downs): 22arrowimages: {down:['downarrowclass', 'images/down.gif', 6], right:['rightarrowclass', 'images/right.png']}, 23transition: {overtime:300, outtime:300}, //duration of slide in/ out animation, in milliseconds 24shadow: {enable:false, offsetx:15, offsety:9}, //enable shadow? 25showhidedelay: {showdelay: 100, hidedelay: 200}, //set delay in milliseconds before sub menus appear and disappear, respectively 26 27///////Stop configuring beyond here/////////////////////////// 28 29detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, //detect WebKit browsers (Safari, Chrome etc) 30detectie6: document.all && !window.XMLHttpRequest, 31css3support: window.msPerformance || (!document.all && document.querySelector), //detect browsers that support CSS3 box shadows (ie9+ or FF3.5+, Safari3+, Chrome etc) 32ismobile:navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) != null, //boolean check for popular mobile browsers 33 34getajaxmenu:function($, setting){ //function to fetch external page containing the panel DIVs 35 var $menucontainer=$('#'+setting.contentsource[0]) //reference empty div on page that will hold menu 36 $menucontainer.html("Loading Menu...") 37 $.ajax({ 38 url: setting.contentsource[1], //path to external menu file 39 async: true, 40 error:function(ajaxrequest){ 41 $menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText) 42 }, 43 success:function(content){ 44 $menucontainer.html(content) 45 ddsmoothmenu.buildmenu($, setting) 46 } 47 }) 48}, 49 50 51buildmenu:function($, setting){ 52 var smoothmenu=ddsmoothmenu 53 var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL 54 $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu" 55 var $headers=$mainmenu.find("ul").parent() 56 $headers.hover( 57 function(e){ 58 $(this).children('a:eq(0)').addClass('selected') 59 }, 60 function(e){ 61 $(this).children('a:eq(0)').removeClass('selected') 62 } 63 ) 64 $headers.each(function(i){ //loop through each LI header 65 var $curobj=$(this).css({zIndex: 100-i}) //reference current LI header 66 var $subul=$(this).find('ul:eq(0)').css({display:'block'}) 67 $subul.data('timers', {}) 68 this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()} 69 this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header? 70 $subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0}) 71 $curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: smoothmenu.arrowimages.down[2]} : {}).append( //add arrow images 72 '<img src="'+ (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[1] : smoothmenu.arrowimages.right[1]) 73 +'" class="' + (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[0] : smoothmenu.arrowimages.right[0]) 74 + '" style="border:0;" />' 75 )
76 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ //if shadows enabled and browser doesn't support CSS3 box shadows 77 this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx : this._dimensions.w), y:(this.istopheader? $subul.offset().top+smoothmenu.shadow.offsety : $curobj.position().top)} //store this shadow's offsets 78 if (this.istopheader) 79 $parentshadow=$(document.body) 80 else{ 81 var $parentLi=$curobj.parents("li:eq(0)") 82 $parentshadow=$parentLi.get(0).$shadow 83 } 84 this.$shadow=$('<div class="ddshadow'+(this.istopheader? ' toplevelshadow' : '')+'"></div>').prependTo($parentshadow).css({left:this._shadowoffset.x+'px', top:this._shadowoffset.y+'px'}) //insert shadow DIV and set it to parent node for the next shadow div 85 } 86 $curobj.hover( 87 function(e){ 88 var $targetul=$subul //reference UL to reveal 89 var header=$curobj.get(0) //reference header LI as DOM object 90 clearTimeout($targetul.data('timers').hidetimer) 91 $targetul.data('timers').showtimer=setTimeout(function(){ 92 header._offsets={left:$curobj.offset().left, top:$curobj.offset().top} 93 var menuleft=header.istopheader && setting.orientation!='v'? 0 : header._dimensions.w 94 menuleft=(header._offsets.left+menuleft+header._dimensions.subulw>$(window).width())? (header.istopheader && setting.orientation!='v'? -header._dimensions.subulw+header._dimensions.w : -header._dimensions.w) : menuleft //calculate this sub menu's offsets from its parent 95 if ($targetul.queue().length<=1){ //if 1 or less queued animations 96 $targetul.css({left:menuleft+"px", width:header._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime) 97 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ 98 var shadowleft=header.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft 99 var shadowtop=header.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : header._shadowoffset.y 100 if (!header.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full 101 header.$shadow.css({opacity:1}) 102 } 103 header.$shadow.css({overflow:'', width:header._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:header._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime) 104 } 105 } 106 }, ddsmoothmenu.showhidedelay.showdelay) 107 }, 108 function(e){ 109 var $targetul=$subul 110 var header=$curobj.get(0) 111 clearTimeout($targetul.data('timers').showtimer) 112 $targetul.data('timers').hidetimer=setTimeout(function(){ 113 $targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime) 114 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ 115 if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them 116 header.$shadow.children('div:eq(0)').css({opacity:0}) 117 } 118 header.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime) 119 } 120 }, ddsmoothmenu.showhidedelay.hidedelay) 121 } 122 ) //end hover 123 }) //end $headers.each() 124 if (smoothmenu.shadow.enable && smoothmenu.css3support){ //if shadows enabled and browser supports CSS3 shadows 125 var $toplevelul=$('#'+setting.mainmenuid+' ul li ul') 126 var css3shadow=parseInt(smoothmenu.shadow.offsetx)+"px "+parseInt(smoothmenu.shadow.offsety)+"px 5px #aaa" //construct CSS3 box-shadow value 127 var shadowprop=["boxShadow", "MozBoxShadow", "WebkitBoxShadow", "MsBoxShadow"] //possible vendor specific CSS3 shadow properties 128 for (var i=0; i<shadowprop.length; i++){ 129 $toplevelul.css(shadowprop[i], css3shadow) 130 } 131 } 132 $mainmenu.find("ul").css({display:'none', visibility:'visible'}) 133}, 134 135init:function(setting){ 136 if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set? 137 var mainmenuid='#'+setting.mainmenuid 138 var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid
139 document.write('<style type="text/css">\n' 140 +mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n' 141 +mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n' 142 +'</style>') 143 } 144 this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow 145 jQuery(document).ready(function($){ //ajax menu? 146 if (typeof setting.contentsource=="object"){ //if external ajax menu 147 ddsmoothmenu.getajaxmenu($, setting) 148 } 149 else{ //else if markup menu 150 ddsmoothmenu.buildmenu($, setting) 151 } 152 }) 153} 154 155} //end ddsmoothmenu variable
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.