Sha256: 477e1fb87355c8c1e943786b4c798d01affef67cfd0bf0588b0f8bc176d76773
Contents?: true
Size: 888 Bytes
Versions: 175
Compression:
Stored size: 888 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 collapseElement(el) { $(el).collapse('hide'); // Bootstrap 4 `.collapse()` method. } 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 collapseElement(menuEl); } } 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
175 entries across 175 versions & 2 rubygems