Template:Team:HokkaidoU Japan/JS

From 2014.igem.org

(Difference between revisions)
Line 15: Line 15:
//define the defaults for the plugin and how to call it
//define the defaults for the plugin and how to call it
-
$.fn.dcMegaMenu = function(options){
+
$.fn.dcmegamenu = function(options){
//set default options   
//set default options   
var defaults = {
var defaults = {
Line 38: Line 38:
//act upon the element that is passed into the design     
//act upon the element that is passed into the design     
-
return $dcMegaMenuObj.each(function(options){
+
return $dcmegamenuObj.each(function(options){
var clSubParent = defaults.classSubParent;
var clSubParent = defaults.classSubParent;
Line 87: Line 87:
}
}
function megaReset(){
function megaReset(){
-
$('li',$dcMegaMenuObj).removeClass('mega-hover');
+
$('li',$dcmegamenuObj).removeClass('mega-hover');
-
$('.sub',$dcMegaMenuObj).hide();
+
$('.sub',$dcmegamenuObj).hide();
}
}
Line 94: Line 94:
$arrow = '<span class="dc-mega-icon"></span>';
$arrow = '<span class="dc-mega-icon"></span>';
var clParentLi = clParent+'-li';
var clParentLi = clParent+'-li';
-
var menuWidth = $dcMegaMenuObj.outerWidth();
+
var menuWidth = $dcmegamenuObj.outerWidth();
-
$('> li',$dcMegaMenuObj).each(function(){
+
$('> li',$dcmegamenuObj).each(function(){
//Set Width of sub
//Set Width of sub
var $mainSub = $('> ul',this);
var $mainSub = $('> ul',this);
Line 147: Line 147:
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');
+
$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,$dcMegaMenuObj).css({top: menuHeight+'px'}).css('z-index','1000');
+
$('.'+clContainer,$dcmegamenuObj).css({top: menuHeight+'px'}).css('z-index','1000');
if(defaults.event == 'hover'){
if(defaults.event == 'hover'){
Line 214: Line 214:
out: megaOut
out: megaOut
};
};
-
$('li',$dcMegaMenuObj).hoverIntent(config);
+
$('li',$dcmegamenuObj).hoverIntent(config);
}
}
Line 225: Line 225:
});
});
-
$('> li > a.'+clParent,$dcMegaMenuObj).click(function(e){
+
$('> 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:57, 20 August 2014