jQuery: slideUp() delay() then slideDown; not working

前端 未结 1 1701
清酒与你
清酒与你 2021-01-12 00:08

I\'m trying to implement a very simple footer notification element to slide up for a moment, then slide back down. I\'m using:

$(\'button\').click( function          


        
相关标签:
1条回答
  • 2021-01-12 01:08

    What you actually want is this:

     $('#message-box').slideDown('slow').delay(1500).slideUp('slow');
    

    You can test it here. Though it seems a bit backwards given your layout, .slideDown() is for showing an element, and .slideUp() is for hiding an element...even though given your CSS it's actually going up when shown.

    Also as an aside, you don't need <html> and <body> tags when editing the fiddle, these are already included...any content in the html frame will go inside the <body>.

    0 讨论(0)
提交回复
热议问题