1/*global $ */ 2$(document).ready(function () { 3 4 "use strict"; 5 6 $('.menu_mega > ul > li:has( > ul)').addClass('menu-dropdown-icon'); 7 //Checks if li has sub (ul) and adds class for toggle icon - just an UI 8 9 10 $('.menu_mega > ul > li > ul:not(:has(ul))').addClass('normal-sub'); 11 //Checks if drodown menu's li elements have anothere level (ul), if not the dropdown is shown as regular dropdown, not a mega menu (thanks Luka Kladaric) 12 13 $(".menu_mega > ul").before("<a href=\"#\" class=\"menu-mobile\">Navigation</a>"); 14 15 //Adds menu-mobile class (for mobile toggle menu) before the normal menu 16 //Mobile menu is hidden if width is more then 959px, but normal menu is displayed 17 //Normal menu is hidden if width is below 959px, and jquery adds mobile menu 18 //Done this way so it can be used with wordpress without any trouble 19 20 $(".menu_mega > ul > li").hover(function (e) { 21 if ($(window).width() > 943) { 22 $(this).children("ul").stop(true, false).fadeToggle(150); 23 e.preventDefault(); 24 } 25 }); 26 //If width is more than 943px dropdowns are displayed on hover 27 28 $(".menu_mega > ul > li").click(function () { 29 if ($(window).width() <= 943) { 30 $(this).children("ul").fadeToggle(150); 31 } 32 }); 33 //If width is less or equal to 943px dropdowns are displayed on click (thanks Aman Jain from stackoverflow) 34 35 $(".menu-mobile").click(function (e) { 36 $(".menu_mega > ul").toggleClass('show-on-mobile'); 37 e.preventDefault(); 38 }); 39 //when clicked on mobile-menu, normal menu is shown as a list, classic rwd menu story (thanks mwl from stackoverflow) 40 41});
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.