如何在页面加载时在图像缩略图查看器上预加载图像。
我 设置了预加载:是的,但图片没有自动预加载。谁知道怎么修它?
rev="targetdiv:loadarea, preload:yes"
谢谢你。
答案 0 :(得分:1)
在头标记之间添加:
<script type="text/javascript">
if (document.images){
preload_image_object = new Image();
// list all image urls here:
image_url = new Array();
image_url[0] = "http://mydomain.com/image0.gif";
image_url[1] = "http://mydomain.com/image1.gif";
image_url[2] = "http://mydomain.com/image2.gif";
image_url[3] = "http://mydomain.com/image3.gif";
var i = 0;
for(i=0; i<=3; i++)
preload_image_object.src = image_url[i];
}
</script>