HTML5 app picture pre-load

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.