开发者

jQuery mouse queue/ css change problem

$(next).click(function(event) {
    even开发者_Python百科t.preventDefault();

    if(parseInt($(container).css('left')) <= (-(container_width-offset))) {
        $(container).animate({
                queue:false,
                left: "0px"
            }, speed, function() {

            });

    } else {
        $(container).animate({
                queue:false,
                left: "-="+offset+"px"
        }, speed, function() { });
    }
});

The preceding code animates a series of floating divs to slide left to right. It all works fine EXCEPT when someone clicks the mouse too quickly, the css doesn't update quick enough and sometimes it will roll to a blank div because this line doesn't register quick enough: parseInt($(container).css('left')) <= (-(container_width-offset))

How can I fix this?


add this line

if($(this).is(":animated")) return;

(after event.preventDefault();)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜