【问题标题】:jQuery slide out navigationjQuery滑出导航
【发布时间】:2012-02-25 16:42:26
【问题描述】:

我在这里做错了什么。动画滑出导航,但不能滑回。

$(document).ready(function() {
$('.navLink').click(function(e){
    var navCount=0;
    if (navCount==0) {
        $('.navigation').stop().animate({'marginLeft':'0px'}, 200);
        $('#waitingPage').stop().animate({'marginLeft':'230px'}, 200);
        var navCount=1;
    }else if (navCount==1){
        $('.navigation').stop().animate({'marginLeft':'-230px'}, 200);
        $('#waitingPage').stop().animate({'marginLeft':'0px'}, 200);
        var navCount=0;
    };
    });
});//END ready

【问题讨论】:

    标签: jquery mobile navigation boolean tablet


    【解决方案1】:

    在我看来,如果您使用 .toggle(),您的代码会简单得多

    类似这样的:

    $('.navLink').toggle(function(){
    
        // animation code
    
    }, function(){
    
        // animation code
    
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多