Template:Team:HokkaidoU Japan/JS
From 2014.igem.org
(Difference between revisions)
Line 37: | Line 37: | ||
//call in the default options | //call in the default options | ||
var options = $.extend(defaults, options); | var options = $.extend(defaults, options); | ||
- | var $ | + | var $dcmegamenuObj = this; |
//act upon the element that is passed into the design | //act upon the element that is passed into the design | ||
- | return $ | + | return $dcmegamenuObj.each(function(options){ |
var clSubParent = defaults.classSubParent; | var clSubParent = defaults.classSubParent; | ||
Line 96: | Line 96: | ||
$arrow = '<span class="dc-mega-icon"></span>'; | $arrow = '<span class="dc-mega-icon"></span>'; | ||
var clParentLi = clParent+'-li'; | var clParentLi = clParent+'-li'; | ||
- | var menuWidth = $ | + | var menuWidth = $dcmegamenuObj.outerWidth(); |
- | $('> li',$ | + | $('> li',$dcmegamenuObj).each(function(){ |
//Set Width of sub | //Set Width of sub | ||
var $mainSub = $('> ul',this); | var $mainSub = $('> ul',this); | ||
Line 149: | Line 149: | ||
var fw = menuWidth - cpad; | var fw = menuWidth - cpad; | ||
$mainSub.parent('.'+clContainer).css({width: fw+'px'}); | $mainSub.parent('.'+clContainer).css({width: fw+'px'}); | ||
- | $ | + | $dcmegamenuObj.addClass('full-width'); |
} | } | ||
var iw = $('.mega-unit',$mainSub).outerWidth(true); | var iw = $('.mega-unit',$mainSub).outerWidth(true); | ||
Line 202: | Line 202: | ||
// Set position of mega dropdown to bottom of main menu | // Set position of mega dropdown to bottom of main menu | ||
var menuHeight = $('> li > a',$dcMegaMenuObj).outerHeight(true); | var menuHeight = $('> li > a',$dcMegaMenuObj).outerHeight(true); | ||
- | $('.'+clContainer,$ | + | $('.'+clContainer,$dcmegamenuObj).css({top: menuHeight+'px'}).css('z-index','1000'); |
if(defaults.event == 'hover'){ | if(defaults.event == 'hover'){ | ||
Line 213: | Line 213: | ||
out: megaOut | out: megaOut | ||
}; | }; | ||
- | $('li',$ | + | $('li',$dcmegamenuObj).hoverIntent(config); |
} | } | ||
Line 224: | Line 224: | ||
}); | }); | ||
- | $('> li > a.'+clParent,$ | + | $('> li > a.'+clParent,$dcmegamenuObj).click(function(e){ |
var $parentLi = $(this).parent(); | var $parentLi = $(this).parent(); | ||
if($parentLi.hasClass('mega-hover')){ | if($parentLi.hasClass('mega-hover')){ |
Revision as of 07:39, 20 August 2014