开发者

load jquery before elements on a page

How do i load jquery before all the html elements to stop unstyled content flashing before jquery kicks in.

I know you can do this with display:none in the css but I would like to know how to do it in an accesible way.

heres an example

http://satbulsara.com/tests开发者_开发技巧/


I've used this guy's advice with a nice fadeIn() effect to great satisfaction: 1 Way to Avoid the Flash of Unstyled content


You could use a very small javascript file in the head, which only sets visibility: hidden to the relevant elements, and comes before jquery.

Of course you will have to use the DOM directly

document.getElementById('someImage').style.visibility = 'hidden';


Based on your example, I think you're looking for a preloader? I've used this one before with great results: http://www.gayadesign.com/diy/queryloader-preload-your-website-in-style/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜