How do you pause before fading an element out using jQuery?

后端 未结 8 512
滥情空心
滥情空心 2020-12-29 03:12

I would like to flash a success message on my page.

I am using the jQuery fadeOut method to fade and then remove the element. I can increase the duratio

8条回答
  •  我在风中等你
    2020-12-29 03:55

    dansays's answer just doesn't work for me. For some reason, remove() runs immediately and the div disappears before any animations happen.

    The following works, however (by omitting the remove() method):

    $('#foo').fadeIn(500).delay(5000).fadeOut(500);
    

    I don't mind if there are hidden DIVs on the page (there shouldn't be more than a few anyway).

提交回复
热议问题