functionLaimgload () {}//picture pre-loaded JSLaimgload.prototype.winHeight =function(){//Calculate page Height varWinheight = 0; //Get window Height if(window.innerheight) {winheight=Window.innerheight; }Else if((document.body) &&(Document.body.clientHeight)) {Winheight=Document.body.clientHeight; } returnWinheight;} LAIMGLOAD.PROTOTYPE.LOADIMG=function(arr) {//picture pre-load execution for(vari = 0,len = Arr.length; i < Len; i++){ if(Arr[i].getboundingclientrect (). top- This. Winheight () < Document.documentElement.clientHeight &&!arr[i].isload) {Arr[i].isload=true; Arr[i].style.csstext= "Transition:"; opacity:0; "; if(arr[i].dataset) { This. aftloadimg (arr[i],arr[i].dataset.original); }Else{ This. Aftloadimg (Arr[i],arr[i].getattribute ("Data-original")); } (function(i) {setTimeout (function() {Arr[i].style.csstext= "TRANSITION:1S; opacity:1; " },16)}) (i); }}}laimgload.prototype.aftloadimg=function(Obj,url) {//Picture Address Switch varOimg =NewImage (); OIMG.SRC=URL; if(oimg.complete) {obj.src=oimg.src; }Else{oimg.onload=function() {obj.src=oimg.src; }; }}_laimgload=Newlaimgload ();/*picture pre-loaded JS * Put the picture Then get the picture collection passed in the call function below to get a picture collection of the jquery method $ ("#content_ ID "). FIND (" img "); * Call Method: _laimgload.loadimg ("The collection of pictures here"); * @author waves **/
HTML5 app picture pre-load