|
|
Preloading multiple images using single function - Javascript
|
Views : 861
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Hi...
In our webpage having more images means that takes lot of times to load all images. To overcome this issue use the below code.
<script type="text/javascript>
function preload()
{
var args=preload.arguments;
document.imageArray=new Array(args.length);
for(var i=0;i<args.length;i++)
{
document.imageArray[i]=new Image;
document.imageArray[i].src=args[i];
}
}
</script>
Call the preload() function.
<body onload="preload('img1.gif','img2.gif',...)">
|
|
By Nirmala, On - 2009-05-20 |
|
|
|