Image Caching by using Javascript.

When you want to use the image several times at same URL, you can call it from image object that you referred at first time by using image caching.

Using this way makes it possible not to make image blink when it got focus by hover or tab action. Really helpful and easy to apply to your code.

———————————————-

function MM_preloadImages(){

var d=document;

if(d.images)
{
if(!d.MM_p)
d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
for(i=0; i<a.length; i++)
{
if (a[i].indexOf("#")!=0)
{
d.MM_p[j]=new Image();
d.MM_p[j++].src=a[i];
}
}
}
}

MM_preloadImages('/images/common/gnb_tab_03_01.png',
'/images/common/gnb_tab_03_02.png',
'/images/common/gnb_tab_03_03.png');

Thanks to “http://happybruce.tistory.com&#8221;

By awesomejude Posted in JS