[_] fat javascript and flckering
speed wolf
speedwolf at gmail.com
Thu Dec 3 14:01:12 GMT 2009
If images not downloading due to display: none; then put them on a spritesheet with the rest of the site furniture as then the browser would already have it in cache ready to spring up like a frog in a dynamite pond. Pete On Thu, Dec 3, 2009 at 1:55 PM, Adam Alton <adam.alton at teamrubber.com> wrote: > > <script type='text/javascript'>$('html').addClass('js');</script> > +1 > We use this technique a lot, it's really powerful, and means that if > you're using Javascript to turn ugly things into sexy things you don't > need to wait for the whole page to load and your JS to run before the > ugly stuff gets hidden. You can put all of your JS at the bottom of > the page, so that it gets loaded after page render, but things that > you want to hide for JS users are hidden before they are rendered. > I would actually do: > document.getElementsByTagName('html')[0].id = 'hasJS'; > which means that: > a) you don't need to put the jQuery library <script> in the <head>, > you can put it at the bottom of the <body>, so the content loads > faster and jQuery niceness comes at the end, and > b) giving it an id rather than a class gives it more CSS specifity > which in this case is usually a good thing. > > Is the flickering caused by the browser not bothering to download > images until you do $('body').show(); ? Do browsers load background > images for elements that are display:none? > > Adam > > -- > underscore_ list info/archive -> http://www.under-score.org.uk/mailman/listinfo/underscore >