1

我试图让这个按钮在不同时间启动多个操作。我想让公共汽车滑入,然后让消息在电话上淡入。

http://webapps.easy2.com/ce/ext1104/messages/iris_messages.html

我是一个视觉学习者,所以例子会有所帮助,谢谢!

4

2 回答 2

0

http://api.jquery.com/delay/

$('#ID').action1().delay(800).action2();

数字是毫秒。

于 2012-09-17T14:00:17.030 回答
0

您想要的技巧是,在您响应点击之后,您需要在下一次点击之前附加一个新的事件响应。您可以通过以下代码执行此操作...

HTML

<button id="multibutton">Click Me</button>​

JavaScript

$('#multibutton').on('click', function() {
    alert("This is the first alert!");

    // Setup for the second click.
    $(this).off('click');
    $(this).on('click', function() {
        alert("This is the second alert!");
    });
});

这样,一旦第一个事件完成,您将附加下一个事件。而且,当然,如果您有许多不同的事件(而不仅仅是两个),您可以创建一个规则系统,在该系统中您可以在单击按钮的过程中继续移动到下一个规则。

于 2012-09-17T14:01:05.207 回答