.delay() not working when changing background-color of

前端 未结 3 880
半阙折子戏
半阙折子戏 2021-01-22 06:40

I am just learning JQUERY and I have been playing around with delay() I wrote a fiddle to show you... What I am trying to do is when a button is clicked, change the background-c

3条回答
  •  滥情空心
    2021-01-22 07:05

    You can use delay with queue here

      $(".animation").css("background","blue").delay(700)
             .queue(function() {
                $(this).css("background", "red").dequeue();
       });
    

    Wrap above snippet inside click handler.

提交回复
热议问题