(function($){ $.fn.sfMegaMenu = function(options){ var defaults = { onLoad: function(){}, onBeforeOpen: function(){}, onAfterOpen: function(){}, onBeforeClose: function(){}, hoverIntentTimeout:500, /* layout: 'base', 'grid', 'mega' */ layout:'base', showImages:false, /* submenuDirection: 'below', 'above', 'right' */ submenuDirection:'below', subSubmenuDirection:'below', iconOpenRight:'icon-arrow-right3', iconOpenDown:'icon-arrow-down3', iconNoImage:'icon-image', iconPin:'icon-pushpin', idxNum: 1, cloneParentItem: false }; //call in the default otions var options = $.extend(defaults, options); var $sfmmObj = this; var GCNum = [ {'top':'GC28', 'tophover':'GC29', 'sub':'GC30', 'subhover':'GC31'}, {'top':'GC32', 'tophover':'GC33', 'sub':'GC34', 'subhover':'GC35'} ][options.idxNum-1]; var sfmmSetupLayout = {}; function fixGCRules() { var newCSSText = ''; for (var n in GCNum) { var cls = '.'+GCNum[n], oRule = getStyleClass(cls); if (!oRule) continue; var cssTextNew = oRule.cssText.replace(/:.*?;/g, ':inherit;') + oRule.cssText.replace(cls+', '+cls+' a, a '+cls, cls+','+cls+' > a,a > '+cls); newCSSText += cssTextNew; } $('head').append(''); } var startS=0; var startR=0; function getStyleClass(className) { var ss; try { if (d.all) { for (var s = startS; s < d.styleSheets.length; s++) { startS = s+1; // Opera doesn't have this attribute so check for it if (!d.styleSheets[s].imports||d.styleSheets[s].imports.length==0) continue; ss=d.styleSheets[s].imports[0]; for(var r=startR; r li > ul > li > ul > li > ul',$sfmmObj) .prev('a') .append('') .parent() .addClass('has-children') .find('> ul') .remove() ; $('li:not(.see-all) > a',$sfmmObj).each(function(){ if (options.cloneParentItem) { $(this).parent() .clone(true).prependTo($(this).next('ul')) .removeClass('has-children '+GCNum['top']+' '+GCNum['sub']).addClass(GCNum['sub']+' see-all') .find('a.idx'+options.idxNum) .removeClass('idx'+options.idxNum+' '+GCNum['top']).addClass('idx'+options.idxNum+'Sub') .attr({'sf:object': 'idx'+options.idxNum+'Sub', 'id': $(this).attr('id').replace(/(idx\d+)(.*)/, '$1Sub$2')}) .end() .find('ul,i').remove() ; if ($(this).next('ul').length > 0) { $(this).attr('name',$(this).attr('href')).removeAttr('href').css({cursor:'pointer'}); } } }); $('> li > a + ul > li > a',$sfmmObj).not('+ ul') .parent() .append('') ; if (showImages) { $('> li > a + ul > li > a + ul',$sfmmObj) .prepend('
') ; } $('> li > a + ul > li > a + ul',$sfmmObj) .addClass(GCNum['sub']) .addClass('sfmm-flyout') .parent().parent() .addClass('sfmm-dropdown-content') .wrap('