1var ddsmoothmenu={ 2 3arrowimages: {down:['downarrowclass', 'down.gif', 0], right:['rightarrowclass', 'right.gif',0]}, 4 5transition: {overtime:200, outtime:200}, 6shadow: {enable:false, offsetx:5, offsety:5}, 7detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, 8detectie6: document.all && !window.XMLHttpRequest, 9 10getajaxmenu:function($, setting){ 11 var $menucontainer=$('#'+setting.contentsource[0]) 12 $menucontainer.html("Loading Menu...") 13 $.ajax({ 14 url: setting.contentsource[1], //path to external menu file 15 async: true, 16 error:function(ajaxrequest){ 17 $menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText) 18 }, 19 success:function(content){ 20 $menucontainer.html(content) 21 ddsmoothmenu.buildmenu($, setting) 22 } 23 }) 24}, 25 26buildmenu:function($, setting){ 27 var smoothmenu=ddsmoothmenu 28 var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL 29 $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu" 30 var $headers=$mainmenu.find("ul").parent() 31 $headers.hover( 32 function(e){ 33 $(this).children('a:eq(0)').addClass('selected') 34 }, 35 function(e){ 36 $(this).children('a:eq(0)').removeClass('selected') 37 } 38 ) 39 $headers.each(function(i){ //loop through each LI header 40 var $curobj=$(this).css({zIndex: 100-i}) //reference current LI header 41 var $subul=$(this).find('ul:eq(0)').css({display:'block'}) 42 this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()} 43 this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header? 44 $subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0}) 45 46 if (smoothmenu.shadow.enable){ 47 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 48 if (this.istopheader) 49 $parentshadow=$(document.body) 50 else{ 51 var $parentLi=$curobj.parents("li:eq(0)") 52 $parentshadow=$parentLi.get(0).$shadow 53 } 54 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 55 } 56 $curobj.hover( 57 function(e){ 58 var $targetul=$(this).children("ul:eq(0)") 59 this._offsets={left:$(this).offset().left, top:$(this).offset().top} 60 var menuleft=this.istopheader && setting.orientation!='v'? 0 : this._dimensions.w 61 menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader && setting.orientation!='v'? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft //calculate this sub menu's offsets from its parent 62 if ($targetul.queue().length<=1){ //if 1 or less queued animations 63 $targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime) 64 if (smoothmenu.shadow.enable){ 65 var shadowleft=this.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft 66 var shadowtop=this.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : this._shadowoffset.y 67 if (!this.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full 68 this.$shadow.css({opacity:1}) 69 } 70 this.$shadow.css({overflow:'', width:this._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:this._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime) 71 } 72 } 73 }, 74 function(e){ 75 var $targetul=$(this).children("ul:eq(0)") 76 $targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime) 77 if (smoothmenu.shadow.enable){ 78 if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them 79 this.$shadow.children('div:eq(0)').css({opacity:0}
79) 80 } 81 this.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime) 82 } 83 } 84 ) //end hover 85 }) //end $headers.each() 86 $mainmenu.find("ul").css({display:'none', visibility:'visible'}) 87}, 88 89init:function(setting){ 90 if (typeof setting.customtheme=="object" && setting.customtheme.length==2){ //override default menu colors (default/hover) with custom set? 91 var mainmenuid='#'+setting.mainmenuid 92 var mainselector=(setting.orientation=="v")? mainmenuid : mainmenuid+', '+mainmenuid 93 document.write('<style type="text/css">\n' 94 +mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n' 95 +mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n' 96 +'</style>') 97 } 98 this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow 99 jQuery(document).ready(function($){ //ajax menu? 100 if (typeof setting.contentsource=="object"){ //if external ajax menu 101 ddsmoothmenu.getajaxmenu($, setting) 102 } 103 else{ //else if markup menu 104 ddsmoothmenu.buildmenu($, setting) 105 } 106 }) 107} 108 109} 110 111 ddsmoothmenu.init({ 112mainmenuid: "menu-22", //menu DIV id 113orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v" 114classname: 'ddsmoothmenu', //class added to menu's outer DIV 115//customtheme: ["#1c5a80", "#18374a"], 116contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"] 117})
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.