how does stackoverflow implement the "Please consider . . " popups that fade away
i wanted to see if stackoverflow was usi开发者_如何学Pythonng a seperate plugin to do those bright yellow popups that says "Please consider marking this answer as accepted or "Please consider adding a comment to why you down voted"
is this using a jquery plugin for this (something like cluetip, etc) or is this just handrolled ?
I don't know what SO uses, but it's not terribly hard to do something similar with jQuery
Here's a fiddle with something similar : http://jsfiddle.net/yuQ3E/
$('button').click(function() {
$messageCont = $('<div class="message_cont">');
$message = $('<div>Some Message. Wait 3 secs!</div>').hide();
$messageCont.append($message);
$('body').prepend($messageCont);
$message.fadeIn(400, function() {
setTimeout(function(){
$messageCont.fadeOut();
//code to clean up container
}, 3000)
})
});
It's pretty easy to modify it to clean up after itself by removing the container and so forth. Also, if you have the position, you can always make the container popup in a given area.
精彩评论