Sha256: 9fcaf03f3e46203b1f3d684c5925a6e56b07a762b666eacf917f9cca4a533539

Contents?: true

Size: 1.02 KB

Versions: 34

Compression:

Stored size: 1.02 KB

Contents

(function (window, document) {
var menu = document.getElementById('rm-nav'),
    WINDOW_CHANGE_EVENT = ('onorientationchange' in window) ? 'orientationchange':'resize';

function toggleHorizontal() {
    [].forEach.call(
        document.getElementById('rm-nav').querySelectorAll('.rm-can-transform'),
        function(el){
            el.classList.toggle('pure-menu-horizontal');
        }
    );
};

function toggleMenu() {
    // set timeout so that the panel has a chance to roll up
    // before the menu switches states
    if (menu.classList.contains('open')) {
        setTimeout(toggleHorizontal, 500);
    }
    else {
        toggleHorizontal();
    }
    menu.classList.toggle('open');
    document.getElementById('rm-toggle').classList.toggle('x');
};

function closeMenu() {
    if (menu.classList.contains('open')) {
        toggleMenu();
    }
}

document.getElementById('rm-toggle').addEventListener('click', function (e) {
    toggleMenu();
});

window.addEventListener(WINDOW_CHANGE_EVENT, closeMenu);
})(this, this.document);

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
krad-3.2.5 assets/scripts/responsive-menu.js
krad-3.2.4 assets/scripts/responsive-menu.js
krad-3.2.3 assets/scripts/responsive-menu.js
krad-3.2.2 assets/scripts/responsive-menu.js
krad-3.2.1 assets/scripts/responsive-menu.js
krad-3.2.0 assets/scripts/responsive-menu.js
krad-3.1.9b assets/scripts/responsive-menu.js
krad-3.1.9 assets/scripts/responsive-menu.js
krad-3.1.8 assets/scripts/responsive-menu.js
krad-3.1.7 assets/scripts/responsive-menu.js
krad-3.1.6 assets/scripts/responsive-menu.js
krad-3.1.5 assets/scripts/responsive-menu.js
krad-3.1.4 assets/scripts/responsive-menu.js
krad-3.1.3 assets/scripts/responsive-menu.js