I am looking for everything on my page to be hidden until the page has finished loading. I saw a lot of posts and tried different things. The most common solution that works great is
<body style="display:none;">
Then run jQuery to display it again when the window loads
$(window).load(function() { $("body").fadeIn("slow"); });
I have a problem with this as the page is dependent on JS to show anything at all. I appreciate that this is a rare thing, but it just feels wrong.
Ideally, I would like to use jQuery to add a display: none css also
But...
The problem is that I am adding
$(document).ready(function { $(body).css('display', 'none'); });
Even this takes some time, and the page flickers with content before starting work.
Is there a better way?
Can I use the above script without document.ready (try, but didn; t work)
Thanks.
jquery
Pete norris
source share