How do I make a div slide up and disappear in JQuery?
And just...poop, HTML gone. How do I开发者_如何学JAVA do that? thanks.
I know about .hide() , but..I want permanently gone (for that one page), and slide up.
You can use slideUp()
to slide it and then use remove()
to remove it. Something like this:
$("#buttonid").click(function() {
$("selector").slideUp("slow", function() { $(this).remove(); });
});
remove()
will remove the element from the dom.
You can use .slideUp()
http://api.jquery.com/slideUp/
You want the jQuery UI function called slide(), then call $(this).remove() in the callback, like so:
$(function() {
$('div').click(function() {
$(this).slideUp('slow', function() {
$(this).remove();
});
});
});
精彩评论