开发者

How can show closeable <div> in the top of the page

How can show closeable in the top of the pa开发者_如何学Pythonge like stackoverflow new answers. im using asp.net


It's really pretty simple - there's a div, with a control in it (an anchor I imagine) with a click event bound to it which removes the parent item from the DOM. Something like this

 <!-- html -->
 <div id="warning"><a href="#" class='close'>[X]</a></div>

And then some event goodness:

$(document).ready(function() {
    $('.close').bind('click', function(e) {
         $(this).parent.remove();
    });
});

and you're pretty much done. Add salt and CSS to taste.


Do you mean the notification bar? If so, there is a nice demo and code snippet here.

http://tympanus.net/codrops/2009/10/29/jbar-a-jquery-notification-plugin/


Stackoverflow uses Javascript with the JQuery library to create this.


Here are a few jQuery imlpementations of the effect you looking for:

  • Slide Toggle
  • Slide Down
  • Hide
  • Queue

You will have to build on these.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜