Reputation: 137
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?
Upvotes: 8
Views: 8617
Reputation: 3167
Short way:
$('body').after($('<div id="lightBox" style="height: ' + htmlHeight + 'px;"></div>').hide().fadeIn());
Upvotes: 2
Reputation: 50974
$('body').after('<div id="lightBox" style="height: ' + htmlHeight + 'px;"></div>');
$("#lightBox").hide().fadeIn();
It hides it and then fades in
Upvotes: 3
Reputation: 10626
$('body').after('<div id="lightBox" style="height: ' + htmlHeight + 'px; display:none;"></div>');
$('#lightBox').fadeIn();
Upvotes: 4