How do I do those popup messages that come at the top of Stack Overflow?
Those orange windows that appear at the top of the stack overflo开发者_运维问答w site and that have a little cross that you can clear them down with whats the best way to go about doing them?
Id like to pop clearable messages to our users.
Use IE Developer Tools or Firefox Firebug and check html, javascript and css code of this element.
Those are just divs, styled 100%in width and animated by a little piece of javascript (for example jQuery animations). You could place them fixed above everything else (z-index: 100;
) or have a box for the page and a box for those messages before the main box.
What else do you need to know?
Create a div
with color of your choice and add a button/image at the right most corner to close the section (make it go away). Initially this should be hidden
and based on some response from user or some activity (probably using AJAX), you can change the innerHtml content of some element (inside that div) and make that bar visible. The closing button/image should again make that hidden when clicked. To give it an animated effect, you can use jquery hide
and show
features providing a timer value of your choice to make it look good and attract user attention.
This should do the required task.
精彩评论