/* jQuery Mega Menu v1.02 * Last updated: June 29th, 2009. This notice must stay intact for usage * Author: JavaScript Kit at http://www.javascriptkit.com/ * Visit http://www.javascriptkit.com/script/script2/jScale/ for full source code */ jQuery.noConflict(); var jkmegamenu={ effectduration: 300, //duration of animation, in milliseconds delaytimer: 200, //delay after mouseout before menu should be hidden, in milliseconds //No need to edit beyond here megamenulabels: [], megamenus: [], //array to contain each block menu instances zIndexVal: 1000, //starting z-index value for drop down menu $shimobj: null, addshim:function($){ $(document.body).append('') this.$shimobj=$("#outlineiframeshim") }, alignmenu:function($, e, megamenu_pos){ var megamenu=this.megamenus[megamenu_pos] var $anchor=megamenu.$anchorobj var $menu=megamenu.$menuobj var menuleft=($(window).width()-(megamenu.offsetx-$(document).scrollLeft())>megamenu.actualwidth)? megamenu.offsetx : megamenu.offsetx-megamenu.actualwidth+megamenu.anchorwidth //get x coord of menu //var menutop=($(window).height()-(megamenu.offsety-$(document).scrollTop()+megamenu.anchorheight)>megamenu.actualheight)? megamenu.offsety+megamenu.anchorheight : megamenu.offsety-megamenu.actualheight var menutop=megamenu.offsety+megamenu.anchorheight //get y coord of menu $menu.css({left:menuleft+"px", top:menutop+"px"}) this.$shimobj.css({width:megamenu.actualwidth+"px", height:megamenu.actualheight+"px", left:menuleft+"px", top:menutop+"px", display:"block"}) }, showmenu:function(e, megamenu_pos){ var megamenu=this.megamenus[megamenu_pos] var $menu=megamenu.$menuobj var $menuinner=megamenu.$menuinner if ($menu.css("display")=="none"){ this.alignmenu(jQuery, e, megamenu_pos) $menu.css("z-index", ++this.zIndexVal) $menu.show(this.effectduration, function(){ $menuinner.css('visibility', 'visible') }) } else if ($menu.css("display")=="block" && e.type=="click"){ //if menu is hidden and this is a "click" event (versus "mouseout") this.hidemenu(e, megamenu_pos) } return false }, hidemenu:function(e, megamenu_pos){ var megamenu=this.megamenus[megamenu_pos] var $menu=megamenu.$menuobj var $menuinner=megamenu.$menuinner $menuinner.css('visibility', 'hidden') this.$shimobj.css({display:"none", left:0, top:0}) $menu.hide(this.effectduration) }, definemenu:function(anchorid, menuid, revealtype){ this.megamenulabels.push([anchorid, menuid, revealtype]) }, render:function($){ for (var i=0, labels=this.megamenulabels[i]; i