Sha256: 0e9370e3b0b75ebac07495f1751c6fd5184d4d53664cf85b8f94e7bf7c8fa8c8
Contents?: true
Size: 831 Bytes
Versions: 55
Compression:
Stored size: 831 Bytes
Contents
// Custom JS to Close the Navigation menu, if its open, & if the screen goes above 992px wide (Bootstrap 4 'lg' devices) const NAVBAR_COLLAPSE_ID = 'headerGlobalNavbarContent'; // ID built into the sites' HTML function checkNavbarCollapseState(menuEl) { if ( menuEl.classList.contains('show') ) { // 'show' is a Bootstrap 4 class that makes `.collapse` items visible. // Checking to see if the Menu is open $(menuEl).collapse('hide'); // Bootstrap 4 `.collapse()` method. } } function windowResizeHandler() { if ( window.innerWidth >= 992 ) { const menuCollapseElement = document.getElementById(NAVBAR_COLLAPSE_ID); checkNavbarCollapseState(menuCollapseElement); } } function toggleMenuOnWindowResize() { window.addEventListener('resize', windowResizeHandler); } export default toggleMenuOnWindowResize;
Version data entries
55 entries across 55 versions & 1 rubygems