0

我希望一个按钮在 AJAX 调用(以及其他一些动画发生)之前闪烁一小段时间。ajax 调用发生得非常快,所以我不想使用 AJAX 的 before 函数。在任何其他动画之前,眨眼必须是明显的。我觉得好像有一种更漂亮的方法可以做到这一点:

       //This is inside of a button click event
       $(this).addClass('active').delay(250).queue(function (e) {
            $(this).removeClass('active').delay(250).queue(function (f) {
                alert(33);
                $child.css('margin-left', $(window).width() + 10 + 'px');
                $child.load(url + 'API CALL' + $(this).data("id"), bindAClicks);
            });
        });

bindAClicks - 动画到边距:0。

$child 是一个容器 div。

active 是一个具有深色背景的类。

奇怪的是警报甚至没有触发。

4

1 回答 1

0

If you are referring to beforeSend, I would recommend checking out this answer which shows how to wait for your animation to finish.

In response to Oleg's comment, I'm not sure what problem you're having when you say the response is so quick you can't see the blink. I created a quick example to demonstrate how it would work (so you can make the Ajax call and still perform the blink). Hopefully this helps.

于 2012-07-26T20:18:45.687 回答