javascript - jQuery .animate 队列不起作用

标签 javascript jquery syntax jquery-animate

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)

关于javascript - jQuery .animate 队列不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4105132/

相关文章:

javascript - 将鼠标悬停在动态列表上,在单独的 div 中显示适当的文本

javascript - 同时设置点和多边形的样式 Leaflet

c++ - 无法编译简单的 C++ 程序,需要说明

php - 有没有一种简写方法可以将一组变量分配给 php 中数组的每个值?

javascript - 如何使用按钮 "div"函数从 "onclick"元素中删除内容?

javascript - 如何使用 Javascript 根据时间循环遍历 HTML 表

c# - 如何通过 ASP.NET 代码隐藏获取放置在转发器中的 html 文本框的值?

javascript - 使用 javascript 和 jquery 进行拖放

javascript - 动态生成输入类型="file"元素进行多次上传

jquery - 使用 jquery 选择文本框值,修改选择器语法