Notification alert similar to how stackoverflow functions

后端 未结 4 2118
再見小時候
再見小時候 2020-12-13 11:25

How does stackoverflow create the slidedown effect to alert a user of a change ?

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-13 12:06

    Stack Overflow uses the jQuery framework, which has a method to show a hidden element using a simple animation, something like:

    $('#notification-bar').show('slow');
    

    http://api.jquery.com/show/ (check out the demos).

    It is fixed to the top of the page using position:fixed in CSS:

    #notification-bar { 
       position:fixed;
       top: 0px; 
       left: 0px;
       width: 100%;
    }
    

提交回复
热议问题