1

我有一个网站,我必须同时为“几个”元素设置动画。当所有元素完成动画(我用它测试$(:animated) == 1)时,我有一个 ajax 请求。一切都适用于大约 120 个元素,但是当涉及到更多的元素时,脚本会变得很忙,浏览器会要求我停止脚本:-/ 这是我的代码:

$('.wrapper-1, .wrapper-2').animate({
            scrollLeft: 50
        },{
            queue: false, //I thought this would help, has no influence
            complete: function() {
                if($(':animated').length==1){

                        //do fancy stuff and get ajax contents              

                } //END if animated
            }//END scroll animation complete
        });//END animate

有谁知道我如何处理更多的元素?

谢谢

4

0 回答 0