I am wondering if there is a simpler way to have an item from a list faded out then removed than this:
$('li').on('click', function() {
$(this).fadeOut(2000, function(){this.remove();});
});
It works, but seems a bit convoluted. Thanks.
The most you can do is probably this:
$("li").on("click", function(){
$(this).fadeOut(2000, this.remove);
});
jQuery already did most of the abstraction for you and there isn't really much you can do to shorten it. Remember this is not code golf - you don't get points for using the shortest code.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments