1if (typeof jQuery === 'function') { 2 $(function () { 3 var activeMenuItemBackgroundClass = 'black-background', 4 subMenuClass = '.primary-navigation-div'; 5 6 $('.primary-navigation-link-trigger').click(activateSubMenu); 7 8 $(window).resize(function () { 9 $('.primary-navigation-link-trigger').each(function (index, menuItem) { 10 $subNav = $(menuItem).next(); 11 setElementWidth($subNav); 12 positionNextElement($subNav, $(menuItem)); 13 }); 14 }); 15 16 function highlightThisMenuItem(menuItem) { 17 $('.primary-navigation-link-trigger').removeClass(activeMenuItemBackgroundClass); 18 menuItem.addClass(activeMenuItemBackgroundClass); 19 } 20 21 function positionNextElement(nextElement, link) { 22 var linkPosition, 23 linkPositionX, 24 linkPositionY; 25 26 linkPosition = link.position(); 27 linkPositionX = linkPosition.left; 28 linkPositionY = linkPosition.top + 30; 29 30 nextElement.css({ 31 'left': linkPositionX, 32 'top': linkPositionY 33 }); 34 } 35 36 function setElementWidth(element) { 37 var windowWidth = $(window).width(), 38 elementWidth; 39 40 if (windowWidth < 768) { 41 elementWidth = windowWidth - 21; // 21 = padding and margins 42 } else { 43 elementWidth = 368; 44 } 45 46 element.css('width', elementWidth); 47 } 48 49 function activateSubMenu(ev) { 50 var menuItem = $(this); 51 var $subNav = menuItem.next(); 52
53 if (menuItem.hasClass(activeMenuItemBackgroundClass)) { 54 menuItem.removeClass(activeMenuItemBackgroundClass); 55 $subNav.hide(); 56 } else { 57 highlightThisMenuItem(menuItem); 58 setElementWidth($subNav); 59 positionNextElement($subNav, menuItem); 60 $(subMenuClass).hide(); 61 $subNav.show(); 62 } 63 } 64 }) 65};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.