//HTML<div id="Loading" class="Loading"> <divclass="Load"> <span id="Loadingspan"></span> </div></div><div id="content">"content_01.jpg"/>content_02.jpg />content_03.jpg /> "content_04.jpg" /> </div>//JS<script type="Text/javascript">varCore = { //Resource Pre-loadingloadresources:function () {varBodyheight =$ (window). Height (); $("#loading"). Height (bodyheight); varImgpath ="images/"; varSourcearr = [ 'content_01.jpg', 'content_02.jpg', 'content_03.jpg', 'content_04.jpg', 'content_05.jpg' ]; for(vari =0; i < sourcearr.length; i++) {Sourcearr[i]= (Imgpath +Sourcearr[i]); } varLoadImage =function (path, callback) {varIMG =NewImage (); Img.onload=function () {Img.onload=NULL; callback (path); } img.src=path; } varImgloader =function (IMGs, callback) {varLen = imgs.length, i =0; while(imgs.length) {LoadImage (Imgs.shift (), function (path) {callback (P Ath,++I, Len); }); } } varBodyh =Document.documentElement.clientHeight; Imgloader (Sourcearr, function (path, Curnum, total) {varPercent = Curnum/Total ; document.getElementById ('Loadingspan'). InnerHTML ='Resource Loading ...'+ Math.floor (Percent * -) +"%"; if(Percent = =1) {setTimeout (Core.showpage, -); } }); } (), //the resource is loaded and the page content is displayedShowpage:function () {$ ("#loading"). Remove (); $("#content"). Show (); } } </script>
Turn from: TX lol
JS Implementation page picture loading progress bar