7

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?

Mohammad
  • 21,175
  • 15
  • 55
  • 84
novactown
  • 129
  • 1
  • 8

3 Answers3

4
$('body').after('<div id="lightBox" style="height: ' + htmlHeight + 'px; display:none;"></div>');
$('#lightBox').fadeIn();
vantrung -cuncon
  • 10,207
  • 5
  • 47
  • 62
3
$('body').after('<div id="lightBox" style="height: ' + htmlHeight + 'px;"></div>');  
$("#lightBox").hide().fadeIn();

It hides it and then fades in

genesis
  • 50,477
  • 20
  • 96
  • 125
2

Short way:

$('body').after($('<div id="lightBox" style="height: ' + htmlHeight + 'px;"></div>').hide().fadeIn());
directory
  • 3,093
  • 8
  • 45
  • 85