1jQuery(document).ready(function($) { 2 'use strict'; 3 4 // Only run on desktop 5 if (window.innerWidth <= 991) return; 6 7 // Add hover class on mouse enter 8 $('.travel-nav-list > li').on('mouseenter', function() { 9 // Close all other open submenus 10 $('.travel-nav-list > li').not(this).removeClass('hover') 11 .find('> .sub-menu, > .children') 12 .css({ 13 'opacity': '0', 14 'visibility': 'hidden', 15 'pointer-events': 'none' 16 }); 17 18 // Open current submenu 19 $(this).addClass('hover'); 20 $(this).find('> .sub-menu, > .children') 21 .css({ 22 'opacity': '1', 23 'visibility': 'visible', 24 'pointer-events': 'auto', 25 'display': 'block' 26 }); 27 }); 28 29 // Close submenu on mouse leave from the main navigation 30 $('.travel-nav').on('mouseleave', function() { 31 $('.travel-nav-list > li.hover').removeClass('hover') 32 .find('> .sub-menu, > .children') 33 .css({ 34 'opacity': '0', 35 'visibility': 'hidden', 36 'pointer-events': 'none' 37 }); 38 }); 39 40 // Keep submenu open when hovering over it 41 $('.travel-nav-list .sub-menu, .travel-nav-list .children').on('mouseenter', function() { 42 $(this).parent().addClass('hover'); 43 $(this).css({ 44 'opacity': '1', 45 'visibility': 'visible', 46 'pointer-events': 'auto', 47 'display': 'block' 48 }); 49 }); 50 51 // Handle clicks on menu items with children 52 $('.travel-nav-list .menu-item-has-children > a').on('click', function(e) { 53 if (window.innerWidth > 991) { 54 e.preventDefault(); 55 $(this).siblings('.sub-menu, .children').stop(true, true).fadeToggle(150); 56 } 57 }); 58});
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.