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