I’m using a jQuery plugin for sliding panes of content. For about 400ms all the page elements flashes up (text, images, etc.) on top of themselves making for a messy garbled jumble… a brouhaha you could say.
Then the stylesheet comes along and sorts it all out. But for the sake of professionalism and perfectionism I’d like to hide all the content until the stylesheet has loaded.
$(document).ready is inappropriate because boom… that’s my problem. onload() doesn’t work either because then all content is hidden until the page completely renders (images…4, 5, 6 seconds…zzzzzzzz….)
So does anyone know what the options are? (And would it be possible to play Girl From Ipanema midi during page load? :p)
You can have the stylesheet hide specific elements as
display: noneuntil they are needed.However, if you do this directly in the stylesheet you’ve got accessibility problems, as on a browser without JavaScript available the content will not appear at all. A way around this is to key the hiddenness on a variable that is set from JavaScript before any of the deferrable elements are loaded, for example as a class on
<body>: