最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery flashing effect button animation (fiddle provided) - Stack Overflow

programmeradmin2浏览0评论

Please check out my fiddle. Why does the flash effect only happen on the first click. After that it does not flash anymore:

/

 $("#button").click(function (e) {
$(this).css('background', '#03182B').delay(500).queue(function(d) {
    $(this).css('background', '');
});
 });

Please check out my fiddle. Why does the flash effect only happen on the first click. After that it does not flash anymore:

http://jsfiddle/vyAkk/

 $("#button").click(function (e) {
$(this).css('background', '#03182B').delay(500).queue(function(d) {
    $(this).css('background', '');
});
 });
Share Improve this question asked Jul 27, 2012 at 17:22 user974896user974896 1,8134 gold badges30 silver badges48 bronze badges 1
  • interesting im curious to see the solution myself – Frank Visaggio Commented Jul 27, 2012 at 17:26
Add a ment  | 

2 Answers 2

Reset to default 5

You're not dequeueing.

$("#button").click(function(e) {
    $(this).css('background', '#03182B').delay(500).queue(function(d) {
        $(this).css('background', '');
        $(this).dequeue();
    });
});​

jsFiddle example

Something's getting mucked up in the event queue. Try stop()ing the chain of events each time before you run the animation:

$("#button").click(function (e) {
  $(this).stop().css('background', '#03182B').delay(500).queue(function(d) {
    $(this).css('background', '');
  });
});

Fiddle

发布评论

评论列表(0)

  1. 暂无评论