JQuery导航打开/关闭导航

时间:2014-10-07 09:22:57

标签: jquery animation triggers navigation

我有这个Jquery代码,通过单击div #showMenu触发动画导航。但我不能让它“再次关闭它”。任何帮助都会得到满足。

function init() {
    var showmenu = document.getElementById( 'showMenu' ),
        perspectiveWrapper = document.getElementById( 'perspective' ),
        container = perspectiveWrapper.querySelector( '.container' ),
        contentWrapper = container.querySelector( '.wrapper' );

    showMenu.addEventListener( clickevent, function( ev ) {
        ev.stopPropagation();
        ev.preventDefault();
        docscroll = scrollY();
        // change top of contentWrapper
        contentWrapper.style.top = docscroll * -1 + 'px';
        // mac chrome issue:
        document.body.scrollTop = document.documentElement.scrollTop = 0;
        // add modalview class
        classie.add( perspectiveWrapper, 'modalview' );
        // animate..
        setTimeout( function() { classie.add( perspectiveWrapper, 'animate' ); }, 25 );
    });

祝你好运 Jesper Andersen

0 个答案:

没有答案