1// Vanilla replacement for Foundation's responsiveToggle plugin: the 2// title-bar hamburger (data-toggle="main-menu") shows/hides the top-bar 3// menu on small screens; at the medium breakpoint (40em, same as the old 4// Foundation setting) the menu is always visible. 5(function () { 6 'use strict'; 7 var menu = document.getElementById('main-menu'); 8 if (!menu) return; 9 10 var mq = window.matchMedia('(min-width: 40em)'); 11 12 function applyBreakpoint() { 13 menu.style.display = mq.matches ? '' : 'none'; 14 } 15 16 var toggles = document.querySelectorAll('[data-toggle="main-menu"]'); 17 for (var i = 0; i < toggles.length; i++) { 18 toggles[i].addEventListener('click', function () { 19 if (mq.matches) return; // always visible on medium+ 20 menu.style.display = (menu.style.display === 'none') ? '' : 'none'; 21 }); 22 } 23 24 if (mq.addEventListener) mq.addEventListener('change', applyBreakpoint); 25 else mq.addListener(applyBreakpoint); // older Safari 26 applyBreakpoint(); 27})();
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.