【问题标题】:Jquery preload images 1 through 40 [duplicate]Jquery预加载图像1到40 [重复]
【发布时间】:2014-09-14 17:27:07
【问题描述】:

我正在预加载图像,我正在尝试加载 1 到 40,但它不起作用:( 这是代码:

function preload(arrayOfImages){
 $(arrayOfImages).each(function(){
  (new Image()).src = this;
 });
};preload(['/img/wallpapers/'images 1 to 40'.jpg']);

【问题讨论】:

    标签: javascript jquery html preloading


    【解决方案1】:
    function preload(arrayOfImages){
     $(arrayOfImages).each(function(){
      (new Image()).src = this;
     });
    
     for(i=1;i<=40;i++)
      preload('/img/wallpapers/'images' + i + '.jpg');
    

    【讨论】:

    • 标题从 1 到 40,所以我认为 for(i=1;i
    猜你喜欢
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多