简体   繁体   English

jQuery toggleClass切换的类,但不会多次运行动画

[英]Jquery toggleClass toggle's class but doesn't run animation more than once

The problem is that I have a certain link that I want to pull the div upward over the screen if clicked but to be able to be clicked and pulled back down. 问题是我有一个特定的链接,如果单击该链接,我想将div向上拉到屏幕上方,但可以单击并向下拉。 Problem is, it only does it once and then no more. 问题是,它只会执行一次,然后不再执行。 I check in Chrome's style checker and the class toggles on and off as expected, but it refuses to run the animation I'm lost 我检查了Chrome的样式检查器,并且该类按预期方式打开和关闭,但它拒绝运行丢失的动画

Here's a short code example: 这是一个简短的代码示例:

$('#gallL a').unbind('click');
    $('#gallL').click(function(){
    var $this = $(this);
        $this.toggleClass('hlinks hlinksClicked');
        if($this.hasClass('hlinksClicked')) {
            $(foot).animate({
            'bottom':   $(window).height()-60}, 900, 'easeOutBounce');
        } else {
            $(foot).css({'top': '0px'});
            $(foot).animate({
            'top':      $(window).height()-60}, 900, 'easeOutBounce');
        }
    });

seems simple enough but no go :-( 似乎很简单,但是不行:-(

您一次使用最低值制作动画,而另一次使用最高值制作动画。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM