久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='cKb9D'></small><noframes id='cKb9D'>

  • <i id='cKb9D'><tr id='cKb9D'><dt id='cKb9D'><q id='cKb9D'><span id='cKb9D'><b id='cKb9D'><form id='cKb9D'><ins id='cKb9D'></ins><ul id='cKb9D'></ul><sub id='cKb9D'></sub></form><legend id='cKb9D'></legend><bdo id='cKb9D'><pre id='cKb9D'><center id='cKb9D'></center></pre></bdo></b><th id='cKb9D'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cKb9D'><tfoot id='cKb9D'></tfoot><dl id='cKb9D'><fieldset id='cKb9D'></fieldset></dl></div>

  • <legend id='cKb9D'><style id='cKb9D'><dir id='cKb9D'><q id='cKb9D'></q></dir></style></legend>

      • <bdo id='cKb9D'></bdo><ul id='cKb9D'></ul>

        <tfoot id='cKb9D'></tfoot>
      1. 如何監控圖像源的滿載狀態

        How to monitor an image source for fully loaded status(如何監控圖像源的滿載狀態)
          <legend id='3qbcE'><style id='3qbcE'><dir id='3qbcE'><q id='3qbcE'></q></dir></style></legend>

          <small id='3qbcE'></small><noframes id='3qbcE'>

          • <tfoot id='3qbcE'></tfoot>
            • <bdo id='3qbcE'></bdo><ul id='3qbcE'></ul>
                <tbody id='3qbcE'></tbody>
            • <i id='3qbcE'><tr id='3qbcE'><dt id='3qbcE'><q id='3qbcE'><span id='3qbcE'><b id='3qbcE'><form id='3qbcE'><ins id='3qbcE'></ins><ul id='3qbcE'></ul><sub id='3qbcE'></sub></form><legend id='3qbcE'></legend><bdo id='3qbcE'><pre id='3qbcE'><center id='3qbcE'></center></pre></bdo></b><th id='3qbcE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3qbcE'><tfoot id='3qbcE'></tfoot><dl id='3qbcE'><fieldset id='3qbcE'></fieldset></dl></div>

                1. 本文介紹了如何監控圖像源的滿載狀態的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在將大量圖像加載到動態 DIV 中,并且我正在使用預加載器來獲取圖像.

                  I am loading a large number of images into a dynamic DIV and I am using a preloader to get the images.

                  imageObj = new Image();
                  imageObj.src = imgpath + imgname;
                  

                  這些事件中的每一個都會創建一個我可以在 Firebug 中查看和監控的 GET.

                  Each of these events creates a GET that I can see and monitor in Firebug.

                  如果我知道圖片的名稱和路徑,我可以查看相關的 XMLHttpRequest 以查看 GET 是否完成?

                  If I know the name and path of an image, can I watch the relevant XMLHttpRequest to see if the GET has completed?

                  我不想為此過程依賴(或使用).onload 事件.

                  I do not want to rely on (or use) .onload events for this process.

                  偽代碼看起來像這樣......

                  The pseudo would look something like this...

                  if (imageObj.GET = 'complete')
                  

                  有人有這方面的經驗嗎?

                  Has anyone had any experience of this?

                  編輯 1

                  感謝 Bart 的幫助(見下文),我已更改圖像預加載器以存儲圖像對象數組...

                  Thanks to the help from Bart (see below) I have changed my image preloader to store an array of the image objects...

                  function imagePreLoader(imgname) {
                      images[imgnum] = new Image();
                      images[imgnum].src = imgpath + imgname;// load the image
                      imgnum ++;
                  }
                  

                  然后,在我的所有其他函數都運行以構建內容 DIV 之后,我在下面使用了 image.complete 屬性...

                  And then, after all my other functions have run to build the content DIVs, I used the image.complete attribute in the following...

                  var interval = setInterval(function () {
                      imgcount = imgnum - 1; // because the imgnum counter ++ after src is called.
                      ok = 1;
                  
                      for (i=0; i<imgcount; i++) {
                          if (images[i].complete == false){
                              ok = 0;
                          }
                      }
                  
                      if (ok == 1) {
                          clearInterval(interval);
                          showIndexOnLoad();
                      }
                  }, 1000);
                  

                  這會等到所有圖像都完成后,只有當我從間隔函數中得到ok"時才會觸發 showIndexOnLoad() 函數.

                  This waits until all the images are complete and only triggers the showIndexOnLoad() function when I get the 'ok' from the interval function.

                  所有圖像現在都如我所愿,一次全部顯示,無需額外等待 GET 趕上.

                  All images now appear as I wanted, all at once with no additional waits for the GETs to catch up.

                  干得好 Bart 讓我了解 image.complete 屬性.p>

                  Well done Bart for putting me on to the image.complete attribute.

                  推薦答案

                  可以觀察圖片的complete屬性,看看圖片是否加載完畢.

                  You can watch the complete property of the image to see if the image is fully loaded or not.

                  這是一個例子.

                  http://jsfiddle.net/t3esV/1/

                  function load (source) {
                      var img = new Image();
                      img.src = source;
                  
                      console.log('Loading ' + source);
                  
                      var interval = setInterval(function () {
                          if (img.complete) {
                              clearInterval(interval);
                              complete(img);
                          }
                      }, 400);
                  };
                  
                  function complete(img) {
                      console.log('Loaded', img.src);
                      document.body.appendChild(img);
                  };
                  

                  注意:當出現問題并且 complete 從未設置為 true 時,此示例無法清除間隔.

                  Note: This example fails to clear the interval when something goes wrong and complete is never set to true.

                  我寫了一個簡單的 jQuery.preload 插件來利用 圖像.完整的 屬性.

                  I wrote a simple jQuery.preload plugin to take advantage of the image.complete property.

                  這篇關于如何監控圖像源的滿載狀態的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

                  <small id='RcTaZ'></small><noframes id='RcTaZ'>

                  <i id='RcTaZ'><tr id='RcTaZ'><dt id='RcTaZ'><q id='RcTaZ'><span id='RcTaZ'><b id='RcTaZ'><form id='RcTaZ'><ins id='RcTaZ'></ins><ul id='RcTaZ'></ul><sub id='RcTaZ'></sub></form><legend id='RcTaZ'></legend><bdo id='RcTaZ'><pre id='RcTaZ'><center id='RcTaZ'></center></pre></bdo></b><th id='RcTaZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RcTaZ'><tfoot id='RcTaZ'></tfoot><dl id='RcTaZ'><fieldset id='RcTaZ'></fieldset></dl></div>

                2. <legend id='RcTaZ'><style id='RcTaZ'><dir id='RcTaZ'><q id='RcTaZ'></q></dir></style></legend>
                      • <bdo id='RcTaZ'></bdo><ul id='RcTaZ'></ul>

                            <tfoot id='RcTaZ'></tfoot>
                              <tbody id='RcTaZ'></tbody>
                            主站蜘蛛池模板: 欧美精品在线免费观看 | 狠狠的干| 成人激情视频免费观看 | 日韩视频中文字幕 | 在线免费观看黄a | 中文字幕视频一区二区 | 一区二区精品在线 | 欧美国产精品一区二区 | 成人精品在线视频 | 羞羞的视频免费在线观看 | 国产精品视频网站 | 视频1区 | 欧美日韩综合一区 | 日本免费网| 中文字幕在线观看视频一区 | 在线91| 日韩精品免费在线观看 | 国产永久免费 | 亚洲成人动漫在线观看 | 国产精品久久久久久久久久免费看 | 欧美日韩国产在线观看 | 91精品久久久久久久久久 | 国产精品久久久久不卡 | 天堂中文av| 天天视频成人 | 热久久久久 | 激情五月激情综合网 | 欧美一区二区黄 | 妞干网视频 | 日本高清aⅴ毛片免费 | 国精日本亚洲欧州国产中文久久 | 亚洲精品久久久蜜桃 | 亚洲欧美精品在线 | 女人毛片a毛片久久人人 | 91精品91久久久 | 国产一区二区三区高清 | 国产精品久久久久久妇女6080 | 涩色视频在线观看 | 波多野结衣二区 | 久久久久一区 | 国产综合久久久久久鬼色 |