If you want to avoid document.write, append should work just as well (the head element already exists):
$('head').append('<style type="text/css">#mainimage { visibility:hidden }</style>'); On Apr 4, 9:27 pm, Derba <ryancolantu...@gmail.com> wrote: > That works a lot better. Thanks for putting up with my questions > hector. > > On Apr 4, 8:21 pm, Hector Virgen <djvir...@gmail.com> wrote: > > > Actually, it might be better to just start off with 0 opacity and not mess > > with the visibility property at all: > > document.write('<style type="text/css">#mainimage{opacity:0}</style>'); > > $(window).load(function() { > > //when everything is finally loaded, fade image in > > $("#mainimage").animate({opacity: "1"}, 1000); > > > }); > > > -Hector > > > On Sat, Apr 4, 2009 at 4:18 PM, Hector Virgen <djvir...@gmail.com> wrote: > > > Try setting the opacity to 0 when you set it to visible. > > > -Hector > > > > On Sat, Apr 4, 2009 at 4:15 PM, Derba <ryancolantu...@gmail.com> wrote: > > > >> the css visible seems to make it visible before it has a chance to > > >> fade in, but I will tinker with it some to see if I can get it to work.