$('#topnav-static-1432075841997' ).on( 'click', function() { if (!$('.nav-row').hasClass('topnav-added-1432075841997')) { $('#panel-item-1432075841997' ).append("");if (typeof ccomGlobalNavCallback === 'function') {ccomGlobalNavCallback();} (function(){ "use strict"; (function ($) { var mobileScreen = $(window).width() < 768; var navBackBtn, navCloseBtn, navLevelPrimary, navLevelChild; $(function () { navLevelPrimary = $('#main-menu li.parent.primary-level'); navLevelChild = $('#main-menu li.parent.child'); navBackBtn = $('#main-menu #topnav-static-1432075841997 .back-button'); navCloseBtn = $('#topnav-static-1432075841997 .close-nav-section'); var timer; // Disable input focus on mobile devices $('input').blur(); $(window).on("resize", function () { clearTimeout(timer); //call the function after half second timer = setTimeout(function () { navComponents.default(); }, 200); mobileScreen = $(window).width() < 768; // Adjust dropdown height if (mobileScreen) { $('.primary-level > .nav-section').css("height", "inherit"); } else { var desktopNavHeight = $('.parent.active > .nav-section').last().outerHeight(); $('.primary-level > .nav-section').css("height",desktopNavHeight); } // Set desktop menu to fixed if user scrolled down on page if ($(document).scrollTop() > 0 && !mobileScreen) { $(".main-menu-contain").addClass('active'); } }); // Close menu if you click anywhere /*$(document).on('click', function (event) { if (!mobileScreen) { if ($(event.target).closest('.nav-section').length === 0) { $('#main-menu > ul > li.active').removeClass('active'); } } });*/ // Enable default navigation components navComponents.default(); /*$('.search').on('click', function (e) { navComponents.mobileSearch(); });*/ // First level navigation links navLevelPrimary.off('click'); navLevelPrimary.on('click', '> a', function (e) { if(!$(this).parent('li').hasClass("active")){ e.preventDefault(); } e.stopPropagation(); var navHeight = $(this).parent('li').find('> .nav-section').outerHeight(); navComponents.adjustHeight($(this), navHeight); $(this).parent('li').siblings().removeClass('active'); $(this).parent('li').toggleClass('active'); // Set classes for mobile screen if (!mobileScreen) { if ($(this).parent('li').hasClass('active')) { $('html').addClass('no-scroll'); $('nav#main-menu').addClass('active'); } else { $('html').removeClass('no-scroll'); $('nav#main-menu').removeClass('active'); } } var navHeight = $(this).parent('li').find('.active > .nav-section').last().outerHeight(); navComponents.adjustHeight($(this).parent('li').find('> .nav-section'), navHeight); }); // Close mega menu navCloseBtn.on('click', function (e) { $(this).parents('li').toggleClass('active'); }); // Desktop Search /*$('.search-submit').on('click', function (e) { console.log('submit'); $(this).parent('.search-contain').find('.search-input').toggleClass('active'); });*/ }); // Navigation Components var navComponents = { default: function _default(e) { // Mobile Functionlity if (mobileScreen) { // Unbind From Desktop navLevelChild.unbind('click'); $('.menuToggle').unbind('click'); navLevelChild.on('click', function (e) { e.stopPropagation(); var target = $(e.target); if ($(this).hasClass('sub-list')) { e.offsetX = e.offsetX + 40; } var noLink = false; if ( target.is( "a" ) && target.attr('href') == "#" ) { noLink = true; } // Check to see if '+' or '-' is clicked if (e.offsetX > target.outerWidth() || noLink) { e.preventDefault(); $(this).toggleClass('active'); var navSection = $('.parent.active > .nav-section'); var navHeight = $(this).find('> .nav-section').outerHeight(); navComponents.adjustHeight($(this), navHeight); // Check to see user outside the first level of menus if (navSection.length > 1) { $('.primary-level.active .nav-section .back-button span').addClass('active'); // Remove any deeper opened nav sections if ($(this).find('.parent.active').length > 0) { $(this).find('.parent.active').removeClass('active'); } // Remove arrow from back button if (navSection.length == 2) { $('.primary-level.active .nav-section .back-button span').addClass('active'); } } } }); // Mobile Menu Toggle $('.menuToggle').on('click', function (e) { $('.mobile-search').removeClass('active'); navComponents.disableScroll(); navComponents.mobileActive(); }); // Mobile Search $('.search').on('click', function (e) { $('nav#main-menu').removeClass('active'); $('html').removeClass('no-scroll'); //navComponents.mobileSearch(); }); } // Desktop Functionality else { // Unbind From Mobile Functions navLevelChild.unbind('click'); navBackBtn.unbind('click'); navLevelChild.on('click', '> a', function (e) { if(!($(this).parent('li')).is(".sub-list")) { var navHeight = $(this).parent('li').find('> .nav-section').outerHeight(); navComponents.activate($(this), e, navHeight); navComponents.adjustHeight($(this), navHeight); $(this).parents('.nav-section').find('.back-button span').addClass('active'); } }); // Navigation child section back button navBackBtn.on('click', 'span', function (e) { var navSectionFirst = $('.parent.active > .nav-section'); $('.parent.active > .nav-section').last().parent('.parent.active').removeClass('active'); navComponents.adjustHeight($(this), "auto"); var navSectionSecond = $('.parent.active > .nav-section'); console.log(navSectionSecond[navSectionSecond.length - 1]); var navHeight = navSectionSecond.last().outerHeight(); navComponents.adjustHeight($(this), navHeight); // Check to see user outside the first level of menus if (navSectionFirst.length > 1) { // Remove arrow from back button if (navSectionFirst.length == 2) { $(this).removeClass('active'); } } }); } }, activate: function activate($this, e, navHeight) { e.preventDefault(); e.stopPropagation(); $this.parent('li').addClass('active'); }, adjustHeight: function adjustHeight($this, navHeight) { if (!mobileScreen) { //$this.parents('.primary-level > .nav-section').css("height", navHeight); $this.parents('.primary-level').find('.nav-section').first().css("height", navHeight); } }, disableScroll: function disableScroll() { $('html').toggleClass('no-scroll'); }, mobileActive: function mobileActive() { $('nav#main-menu').toggleClass('active'); // Setup mobile scroll to parent menu when use opens navigation if ($('.primary-level.active').length > 0) { var activeMenu = $('.primary-level.active'); var activeMenuTop = activeMenu.position().top; localStorage.setItem('menuTopPosition', activeMenuTop); $('#main-menu').animate({ scrollTop: localStorage.getItem('menuTopPosition') }, '200'); } }, mobileSearch: function mobileSearch() { $('.mobile-search').toggleClass('active'); } }; })(jQuery); // Define your library strictly... })(); var navcolcnt = 3; if(typeof navcolcount !== 'undefined') { navcolcnt = navcolcount; } $('.nav-row.topnav-added-1432075841997, .nav-row.topnav-added-1432075841997 .nav-row').columnlist({ size : navcolcnt, 'class' : 'nav-columns', incrementClass : 'nav-columns-' }); } });