1// JavaScript Document 2//** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com 3//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/ 4//** Menu created: Nov 12, 2008 5 6//** 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 7 8//** Feb 11th, 09" (v1.02): The currently active main menu item (LI A) now gets a CSS class of ".selected", including sub menu items. 9 10//** May 1st, 09" (v1.3): 11//** 1) Now supports vertical (side bar) menu mode- set "orientation" to 'v' 12//** 2) In IE6, shadows are now always disabled 13 14//** July 27th, 09" (v1.31): Fixed bug so shadows can be disabled if desired. 15//** Feb 2nd, 10" (v1.4): Adds ability to specify delay before sub menus appear and disappear, respectively. See showhidedelay variable below 16 17var ddsmoothmenu={ 18 19//Specify full URL to down and right arrow images (23 is padding-right added to top level LIs with drop downs): 20arrowimages: {down:['downarrowclass', 'images/down.gif', ], right:['rightarrowclass', 'images/right.gif']}, 21transition: {overtime:200, outtime:200}, //duration of slide in/ out animation, in milliseconds 22shadow: {enable:true, offsetx:5, offsety:5}, //enable shadow? 23showhidedelay: {showdelay: 100, hidedelay: 200}, //set delay in milliseconds before sub menus appear and disappear, respectively 24 25///////Stop configuring beyond here/////////////////////////// 26 27detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, //detect WebKit browsers (Safari, Chrome etc) 28detectie6: document.all && !window.XMLHttpRequest, 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: 100-i}) //reference current LI header 62 var $subul=$(this).find('ul:eq(0)').css({display:'block'}) 63 $subul.data('timers', {}) 64 // RG: ÐÐ»Ñ rg-cols-2/3 иÑполÑзÑем ÑикÑиÑованнÑÑ ÑиÑÐ¸Ð½Ñ 65 var subulWidth = $subul.outerWidth(); 66 if ($curobj.hasClass('rg-cols-2')) { subulWidth = 480; } 67 else if ($curobj.hasClass('rg-cols-3')) { subulWidth = 660; } 68 this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:subulWidth, 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 '<span class="' + (this.istopheader && setting.orientation!='v'? smoothmenu.arrowimages.down[0] : smoothmenu.arrowimages.right[0]) 73 + '" ></span>' 74 ) 75 if (smoothmenu.shadow.enable){ 76 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 77 if (this.istopheader) 78 $parentshadow=$(document.body) 79 else{ 80 var $parentLi=$curobj.parents("li:eq(0)") 81 $parentshadow=$parentLi.get(0).$shadow 82 } 83 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 84 } 85 $curobj.hover( 86 function(e){
87 var $targetul=$subul //reference UL to reveal 88 var header=$curobj.get(0) //reference header LI as DOM object 89 clearTimeout($targetul.data('timers').hidetimer) 90 $targetul.data('timers').showtimer=setTimeout(function(){ 91 header._offsets={left:$curobj.offset().left, top:$curobj.offset().top} 92 var menuleft=header.istopheader && setting.orientation!='v'? 0 : header._dimensions.w 93 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 94 if ($targetul.queue().length<=1){ //if 1 or less queued animations 95 $targetul.css({left:menuleft+"px", width:header._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime) 96 if (smoothmenu.shadow.enable){ 97 var shadowleft=header.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft 98 var shadowtop=header.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : header._shadowoffset.y 99 if (!header.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full 100 header.$shadow.css({opacity:1}) 101 } 102 header.$shadow.css({overflow:'', width:header._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:header._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime) 103 } 104 } 105 }, ddsmoothmenu.showhidedelay.showdelay) 106 }, 107 function(e){ 108 var $targetul=$subul 109 var header=$curobj.get(0) 110 clearTimeout($targetul.data('timers').showtimer) 111 $targetul.data('timers').hidetimer=setTimeout(function(){ 112 $targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime) 113 if (smoothmenu.shadow.enable){ 114 if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them 115 header.$shadow.children('div:eq(0)').css({opacity:0}) 116 } 117 header.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime) 118 } 119 }, ddsmoothmenu.showhidedelay.hidedelay) 120 } 121 ) //end hover 122 }) //end $headers.each() 123 $mainmenu.find("ul").css({display:'none', visibility:'visible'}) 124}, 125 126init:function(setting){ 127 if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set? 128 var mainmenuid='#'+setting.mainmenuid 129 var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid
130 document.write('<style type="text/css">\n' 131 +mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n' 132 +mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n' 133 +'</style>') 134 } 135 this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow 136 jQuery(document).ready(function($){ //ajax menu? 137 if (typeof setting.contentsource=="object"){ //if external ajax menu 138 ddsmoothmenu.getajaxmenu($, setting) 139 } 140 else{ //else if markup menu 141 ddsmoothmenu.buildmenu($, setting) 142 } 143 }) 144} 145 146} //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.