fade out div after x seconds with jquery

前端 未结 3 597
旧巷少年郎
旧巷少年郎 2021-02-05 05:28

I do a fade in div that is not displayed when I load the page:

    $(\'#overlay\').fadeIn(\'fast\');
    $(\'#box\').fadeIn(\'slow\');

I would

3条回答
  •  借酒劲吻你
    2021-02-05 05:55

    The .delay method is purpose built for what you are describing:

    $('#overlay').fadeIn('fast').delay(1000).fadeOut('fast');
    $('#box').fadeIn('slow').delay(1000).hide(0);
    

    http://jsfiddle.net/SUBnz/1/

提交回复
热议问题