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 18var ddsmoothmenu={ 19arrowimages: {down:['downarrowclass', '/images/modern/tiles/menuplus.png', 10], right:['rightarrowclass', '/images/modern/right.png']}, 20transition: {overtime:400, outtime:300}, //duration of slide in/ out animation, in milliseconds 21shadow: {enable:false, offsetx:0, offsety:0}, //enable shadow? 22showhidedelay: {showdelay: 0, hidedelay: 0}, //set delay in milliseconds before sub menus appear and disappear, respectively 23 24///////Stop configuring beyond here/////////////////////////// 25 26detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, //detect WebKit browsers (Safari, Chrome etc) 27detectie6: document.all && !window.XMLHttpRequest, 28css3support: window.msPerformance || (!document.all && document.querySelector), //detect browsers that support CSS3 box shadows (ie9+ or FF3.5+, Safari3+, Chrome etc) 29 30getajaxmenu:function($, setting){ //function to fetch external page containing the panel DIVs 31 var $menucontainer=$('#'+setting.contentsource[0]) //reference empty div on page that will hold menu 32 $menucontainer.html("Loading Menu...") 33 $.ajax({ 34 url: setting.contentsource[1], //path to external menu file 35 async: true, 36 error:function(ajaxrequest){ 37 $menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText) 38 }, 39 success:function(content){ 40 $menucontainer.html(content) 41 ddsmoothmenu.buildmenu($, setting) 42 } 43 }) 44}, 45 46 47buildmenu:function($, setting){ 48 var smoothmenu=ddsmoothmenu 49 var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL 50 $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu" 51 var $headers=$mainmenu.find("ul").parent() 52 $headers.hover( 53 function(e){ 54 $(this).children('a:eq(0)').addClass('selected') 55 }, 56 function(e){ 57 $(this).children('a:eq(0)').removeClass('selected') 58 } 59 ) 60 $headers.each(function(i){ //loop through each LI header 61 var $curobj=$(this).css({zIndex: 200-i}) //reference current LI header 62 var $subul=$(this).find('ul:eq(0)').css({display:'block'}) 63 $subul.data('timers', {}) 64 this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()} 65 this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header? 66 $subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0}) 67// $curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: smoothmenu.arrowimages.down[2]} : {}).append( //add arrow images 68// '<img src="'+ (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[1] : smoothmenu.arrowimages.right[1]) 69// +'" class="' + (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[0] : smoothmenu.arrowimages.right[0]) 70// + '" style="border:0;" />' 71// ) 72 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ //if shadows enabled and browser doesn't support CSS3 box shadows 73 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 74 if (this.istopheader) 75 $parentshadow=$(document.body) 76 else{ 77 var $parentLi=$curobj.parents("li:eq(0)") 78 $parentshadow=$parentLi.get(0).$shadow 79 } 80 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 81 } 82 $curobj.hover( 83 function(e){ 84 var $targetul=$subul //reference UL to reveal 85 var header=$curobj.get(0) //reference header LI as DOM object 86 clearTimeout($targetul.data('timers').hidetimer) 87 $targetul.data('timers').showtimer=setTimeout(function(){ 88 header._offsets={left:$curobj.offset().left, top:$curobj.offset().top} 89 var menuleft=header.istopheader && setting.orientation!='v'? 0 : header._dimensions.w 90 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 91 if ($targetul.queue().length<=1){ //if 1 or less queued animations 92 $targetul.css({left:menuleft+"px", width:header._dimensions.subulw+'px'}).animate({height:'show', opacity:'show'}
92, ddsmoothmenu.transition.overtime, 'easeOutExpo') 93 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ 94 var shadowleft=header.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft 95 var shadowtop=header.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : header._shadowoffset.y 96 if (!header.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full 97 header.$shadow.css({opacity:1}) 98 } 99 header.$shadow.css({overflow:'', width:header._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:header._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime, 'easeOutExpo') 100 } 101 } 102 }, ddsmoothmenu.showhidedelay.showdelay) 103 }, 104 function(e){ 105 var $targetul=$subul 106 var header=$curobj.get(0) 107 clearTimeout($targetul.data('timers').showtimer) 108 $targetul.data('timers').hidetimer=setTimeout(function(){ 109 $targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime, 'easeOutExpo') 110 if (smoothmenu.shadow.enable && !smoothmenu.css3support){ 111 if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them 112 header.$shadow.children('div:eq(0)').css({opacity:0}) 113 } 114 header.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime, 'easeOutExpo') 115 } 116 }, ddsmoothmenu.showhidedelay.hidedelay) 117 } 118 ) //end hover 119 }) //end $headers.each() 120 if (smoothmenu.shadow.enable && smoothmenu.css3support){ //if shadows enabled and browser supports CSS3 shadows 121 var $toplevelul=$('#'+setting.mainmenuid+' ul li ul') 122 var css3shadow=parseInt(smoothmenu.shadow.offsetx)+"px "+parseInt(smoothmenu.shadow.offsety)+"px 5px #aaa" //construct CSS3 box-shadow value 123 var shadowprop=["boxShadow", "MozBoxShadow", "WebkitBoxShadow", "MsBoxShadow"] //possible vendor specific CSS3 shadow properties 124 for (var i=0; i<shadowprop.length; i++){ 125 $toplevelul.css(shadowprop[i], css3shadow) 126 } 127 } 128 $mainmenu.find("ul").css({display:'none', visibility:'visible'}) 129}, 130 131init:function(setting){ 132 if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set? 133 var mainmenuid='#'+setting.mainmenuid 134 var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid
135 document.write('<style type="text/css">\n' 136 +mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n' 137 +mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n' 138 +'</style>') 139 } 140 this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow 141 jQuery(document).ready(function($){ //ajax menu? 142 if (typeof setting.contentsource=="object"){ //if external ajax menu 143 ddsmoothmenu.getajaxmenu($, setting) 144 } 145 else{ //else if markup menu 146 ddsmoothmenu.buildmenu($, setting) 147 } 148 }) 149} 150 151} //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.