外贸建站之图片预加载JS代码分享

外贸建站之图片预加载JS代码分享

function preloadimg() {
    setTimeout(function() {
        new Image().src = "images/201708/source_img/6590_G_1502767440205.jpg";
                new Image().src = ("images/201708/goods_img/6590_P_1502767440094.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440859.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440464.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440016.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440582.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440093.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440065.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440523.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440716.jpg");
                new Image().src = ("images/201708/goods_img/6590_P_1502767440727.jpg");
            }, 50);
};

以上代码是我们在项目chinaobd2.com中开发的图片预加载函数,现分享出来,供大家学习参考。

案例演示:https://www.chinaobd2.com/wholesale/sbb3-pro3-key-programmer.html

https://www.chinaobd2.com/wholesale/cgdi-at-200-ecu-programmer-for-bmw.html

https://www.chinaobd2.com/wholesale/new-volvo-88890300-vocom-interface-5464.html

上一篇:图片左右滚动的js代码


下一篇:【javascript】获取 格式化时间