繁体   English   中英

jQuery .animate队列不起作用

[英]jQuery .animate queue does not work

Dreamweaver出现错误。 什么是正确的语法?

第一次之后

.animate({left:' - = 980'},550,

真正的优点是:我只能在此代码中使用一个“.animate({left:' - = 980'},550,”如果我想添加两个(或更多).animate,则会出现错误在动画队列中。

顺便说一句:“ clicknr”变量和“ disabled” CSS类-只是一些内部过程的标志。

$('#fwdShowroom').click(function() {
    $button = $(this);
    if ( clicknr != 1 )  {
        if( !$button.hasClass( 'disabled' ) ) {
            $button.addClass( 'disabled' );
            clicknr -= 1,
              $('#showroom ul')
                .animate({left: '-=985'}, 550,
                     Dreamweaver says: Error on this line        .animate({left: '+=5'},200,
                function() { $button.removeClass('disabled') });
        }
    }
});

所需的效果是:“ #showroom ul” DIV平滑地向前移动,然后平滑地向后移动一些像素,以创建良好的物理运动。

您在第一个animate调用中忘记了右括号)

.animate({left: '-=985'},550)

暂无
暂无

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

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