cferdinandi/astro

Add support for multiple collapsed menus with a single toggle

cferdinandi opened this issue · 1 comments

astro.toggleNav = function ( toggle, navID, options, event ) {

    // Selectors and variables
    var settings = extend( settings || defaults, options || {} );  // Merge user options with defaults
    var navs = document.querySelectorAll(navID);

    settings.callbackBefore( toggle, navID ); // Run callbacks before toggling nav
    toggle.classList.toggle( settings.toggleActiveClass ); // Toggle the '.active' class on the toggle element
    forEach(navs, function (nav) {
        nav.classList.toggle( settings.navActiveClass ); // Toggle the '.active' class on the menu
    });
    settings.callbackAfter( toggle, navID ); // Run callbacks after toggling nav

};

v8.0.0