View Full Version : Image load order?
John84
10-15-2007, 02:07 PM
Hey all,
Just wondering if there is a way to control the image load order. I want the background image to load before all the little thumbnail pictures (about 50). Is there a way to do this? I thought maybe something in javascript to do this but if there is a way in php, even better.
Thanks
Just realized this is my 1.000th post - woohoo!
coothead
10-16-2007, 07:47 AM
Hi there John84,
There probably is a php solution but php is not my 'forte'
Here is the javascript solution, that uses setTimeout()
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<base href="http://mysite.orange.co.uk/azygous/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
background-image:url(images/bodyBg.jpg);
}
.border {
border:3px double #000;
}
</style>
<script type="text/javascript">
var thm=[
'images/apple_thumb.jpg',
'images/banana_thumb.jpg',
'images/clouds_thumb.jpg',
'images/dog_thumb.jpg',
'images/girl_thumb.jpg',
'images/grap_thumb.jpg',
'images/ten_quid_thumb.jpg'
]
var speed=5000;
window.onload=function(){
setTimeout('delayThumbs()',speed);
}
function delayThumbs() {
pics=document.getElementById('thumbs').getElementsByTagName('img');
for(c=0;c<pics.length;c++) {
pics[c].src=thm[c];
pics[c].className='border';
}
}
</script>
</head>
<body>
<ul id="thumbs">
<li><img src="" alt="apple"></li>
<li><img src="" alt="banana"></li>
<li><img src="" alt="clouds"></li>
<li><img src="" alt="dog"></li>
<li><img src="" alt="girl"></li>
<li><img src="" alt="grap"></li>
<li><img src="" alt="ten_quid"></li>
</ul>
</body>
</html>
Basic problem with this is that those without javascript enabled will have no thumbnail pics. :supereek:
Of course if they are going to be links then they will, at least, have the alt's to click. ;)
John84
10-16-2007, 06:47 PM
I was given this suggestion...
Try this. Place the background image ON the very top of the page, not as a background, but as an actual image on the page. define it's size as 1px by 1 px, so it will not be seen. This being the first image on the page, even though it's a single pixel, should force it to load first. Since it's the exact same file as what you're using on the background, the background should pop into place before the other images. Hope that made sense...
haven't tried it yet but will give it a shot as it sounds plausible.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.