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

后端 未结 8 496
滥情空心
滥情空心 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条回答
  •  旧时难觅i
    2020-12-29 04:13

    use setTimeout(function(){$elem.hide();}, 5000);

    Where $elem is the element you wish to hide, and 5000 is the delay in milliseconds. You can actually use any function within the call to setTimeout(), that code just defines a small anonymous function for simplicity.

提交回复
热议问题