开发者

Load Javascript external files before images on page

开发者 https://www.devze.com 2023-02-22 23:29 出处:网络
I have a javascript carousel gallery which defines the container my images sit in. Its necessary for the width and height of my images to be set to 100% so that that they are the size of the container

I have a javascript carousel gallery which defines the container my images sit in. Its necessary for the width and height of my images to be set to 100% so that that they are the size of the container and resize with the contain开发者_Go百科er. When the page is loading in ie, presumably before the javascript is loaded the images flash up with their width as 100% of the page, because the java hasnt loaded the container yet?

My page is in php, it didnt do this in html so it might be due to the way php loads?

Is there a way to make the javascript load before the images or to stall the page showing up so the images flashing up isnt seen?

thanks


make the div around the images display:none and then use the document ready stuff to show it. JS runs after the page loads, eg: after images etc.


You may want to use the jquery image preloader.

It loads all the javascript first and preload them later silently, without changing the display during page load

0

精彩评论

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