Jquery to fade in .after()?

novactown picture novactown · Oct 9, 2011 · Viewed 7.5k times · Source

Simple really but cannot get it to work, here is my script...

$('body').after('<div id="lightBox" style="height: ' + htmlHeight + 'px;"></div>');

How can I get it to fade in rather than just pop up? putting fadeIn() after or before .after() doesn't work?

Answer

vantrung -cuncon picture vantrung -cuncon · Oct 9, 2011
$('body').after('<div id="lightBox" style="height: ' + htmlHeight + 'px; display:none;"></div>');
$('#lightBox').fadeIn();