1//MOBILE MENU Functions 2// actMenu() - activate menu - open or close based on state 3// hideWidgets() - hides ALL widgets (only one widget should ever be visible at a time, excepting search) 4// actWidget(widget name) - show calendar, venues, locations, etc... 5// actSearch() - shows mobile search tool if enabled 6 7function actMenu() { 8 swMenu = $("#mobile-menu") 9 swMenu.toggleClass("menu-show"); 10 if (swMenu.hasClass("menu-show")) { 11 swMenu.css("transition", "all 600ms cubic-bezier(0.165, 0.84, 0.44, 1)"); 12 swMenu.css("left", "0px"); 13 } else { 14 swMenu.css("transition", "all 600ms cubic-bezier(0.895, 0.03, 0.685, 0.22)"); 15 swMenu.css("left", "-100%"); 16 } 17} 18 19function actWidget(swWidget) { 20 hideWidgets(); 21 switch (swWidget) { 22 case "calendar": 23 swWidget = $("#calendarWidget"); 24 break; 25 case "venues": 26 swWidget = $("#venuesWidget"); 27 break; 28 case "locations": 29 swWidget = $("#locationsWidget"); 30 break; 31 case "info": 32 swWidget = $("#infoWidget"); 33 break; 34 case "categories": 35 swWidget = $("#categoriesWidget"); 36 break; 37 case "basketChange": 38 swWidget = $("#basketChangeWidget"); 39 break; 40 default: 41 return 0; 42 } 43 //widget show class and transition control position of element in mobile.css 44 swWidget.toggleClass("widget-show"); 45} 46 47function hideWidgets() { 48 $(".widget-show").each(function () { 49 $(this).removeClass("widget-show"); 50 $("#mobile-menu").removeClass("menu-show"); 51 }) 52} 53 54function actSearch() { 55 hideWidgets(); 56 if ($(".menu-show")[0]) { 57 //search requested, menu overlaps 58 actMenu(); 59 if (!$(".search-show")[0]) { 60 $("#swSearch").toggle(400); 61 $("#swSearch").toggleClass("search-show"); 62 $("#swSearchTxt").focus(); 63 $(".mobile-header").css("padding-top", "30px"); 64 } else { 65 $("#swSearch").toggle(400); 66 $("#swSearch").toggleClass("search-show"); 67 $(".mobile-header").css("padding-top", "0px"); 68 } 69 } else { 70 $("#swSearch").toggle(400); 71 $("#swSearch").toggleClass("search-show"); 72 $(".mobile-header").css("padding-top", "30px"); 73 } 74} 75$(document).on('mouseup', function (e) { 76 var container = $(".widget-show"); 77 //hide widgets if user is clicking ouitside of it 78 if (!container.is(e.target) && container.has(e.target).length === 0) { 79 hideWidgets(); 80 } 81 var container = $(".menu-show"); 82 var hamburger = $("#menu-icon") 83 if ($("#mobile-menu").is(":visible") && $("#mobile-menu").hasClass("menu-show")) { 84 //prevent double activation in safari 85 if (!hamburger .is(e.target)) { 86 actMenu(); 87 } 88 89 } 90}); 91 92//Fixed elements do not display properly on mobile zooms, so we will hide them 93//we should also always ensure that the vertical space presented accomodates the mobile menu 94$(window).scroll(function () { 95 //zooming will trigger the scroll event, we use the ratio of client to site width to determine a zoom level 96 var zoomNew = document.documentElement.clientWidth / window.innerWidth; 97 if (zoomNew > 1.05) { // 5% zoom allowed 98 //zoomed in 99 $('.sw-nav').css("opacity", 0); 100 $('.control-wrap').css("opacity", 0); 101 } else { 102 //no zoom 103 $('.sw-nav').css("opacity", 1); 104 $('.control-wrap').css("opacity", 1); 105 } 106 //prevent mobile menu from flowing out past the bottom of the viewport. 107 var deviceHeight = ""; 108 deviceHeight = window.innerHeight - $(".sw-nav").height() - 20; 109 $("#mobile-menu").css("max-height", deviceHeight + "px"); 110}); 111
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.