通过加载图像

时间:2016-04-28 11:45:15

标签: javascript string image-loading dynamic-binding

我正在尝试在页面加载时加载超过数千个图像,并且我希望在加载1/3图像时以图像方式播放图像。它完美地工作到现在。但我想在加载后在队列中添加其余图像。我们可以说在视频中发生缓冲。

到目前为止这已经完成了:

 $(img).one('load', function(e){
     op.imageCounter++;
     layout='<img src="'+this.src+'" class="img">'+layout;

     if(op.imageCounter > (op.images*0.7)) {
         $('#loader').removeClass('loader');
         reversedLayout = layout.split(">").reverse().join("");
         newLayout = reversedLayout.replace(/img"/gi,'img">');
         $('.imageplayer').prepend(newLayout);
         console.log(newLayout);

         if(flag == true) {
             $('.imageplayer').prepend(newLayout);   //this will trigger play. it will start to play 1/3 of images in queue while rest of other will be downloading
             layout = '';
             flag = false;
         } else {   //after playing them here I am trying to append rest of others to that queue but it causes start presentation from first image
             $('.imageplayer').prepend(newLayout);
             newLayout += layout;
             layout = '';
         }
         imgPlay();
     }                 
     imageLoader();
 });

如果有人能提供解决方案,那将会很有帮助。 Thanx提前!!

0 个答案:

没有答案