Reputation: 3032
I have this function in javascript:
function hid(id) {
var x = document.getElementById("desc_div" + id).style.display = "none";
}
and I hope to use fadeOut effect instead of display = "none"
by using jQuery
How can I do that?
Upvotes: 1
Views: 195
Reputation: 218732
function hid(id){
$("#desc_div"+id).fadeOut("slow");
}
See .fadeOut().
Upvotes: 2
Reputation: 16223
You can do it like this:
function hid(id){
$('#'+id).fadeOut();
}
Also, keep in mind you can use fadeOut like: fadeOut( [duration] [, callback] )
, in case you want to specify the duration in milliseconds, and a function to be executed after the animation is over, or .fadeOut( [duration] [, easing] [, callback] )
in case you want to specify an easing function as well.
Upvotes: 0