1jQuery( document ).ready(function( $ ) { 2 3 // Variables 4 var open = false, // Set the state of the menu on load (false = closed) 5 body = $('body'), 6 siteContainer = $('.site-container'), 7 toggleButtons = $('.menu-btn, .close-btn, .site-overlay'); // Trigger buttons 8 9 // Function to open the menu 10 function openMenu() { 11 body.addClass('off-canvas-active'); 12 siteContainer.css({"overflow-x": "hidden"}); // IE Bug 13 } 14 15 // Function to close the menu 16 function closeMenu() { 17 body.removeClass('off-canvas-active'); 18 siteContainer.css({"overflow-x": ""}); // IE Bug 19 } 20 21 /** 22 This is our main function. It checks the "open" variable to see 23 whether our menu is open or not. Depending on the response, we either 24 open or close the menu. 25 **/ 26 function animateMenu() { 27 if (open) { 28 closeMenu(); 29 open = false; 30 } else { 31 openMenu(); 32 open = true; 33 } 34 } 35 36 /** 37 Listen for clicks of any of the toggle buttons set at the top, 38 and initiate the animateMenu() function. 39 **/ 40 toggleButtons.click(function(event) { 41 42 // Prevent the default action of clicking a link 43 event.preventDefault(); 44 45 // Run the main function 46 animateMenu(); 47 }); 48});
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.