//requires Zepto.js support varpage=0;//Current Page varPages=1;//Total Pages varajax=!1;//is loaded inZepto (function($) {$ (window). Scroll (function(){ if($ (window). scrolltop () + $ (window). Height () > $ (document). Height () -40) &&!ajax && pages >page) { //scroll bars to 40 pixels from the bottom, and no Ajax, and no more than the total number of pages //Json_ajax (cla,++page);page++;//current page increased by 1ajax=!0;//Annotated start of Ajax loading$ (". List"). Append (' <div class= "loading" ></div> ");//load picture appears$.ajax ({type:' GET ', URL:'./json.php?page= ' +page+ ' & ' +math.random (), DataType:' JSON ', Success:function(JSON) {pages=json.pages;//Update Total PagesPage=json.page;//Update the current page (JS is not very reliable) for(vari= 0,l = list.length;i<l;i++){ //process data and insert } $(". Loading"). Remove ();//Remove Loading Picturesajax=!1;//Note that Ajax loading has been completed}, Error:function(XHR, type) {$ (". Loading"). HTML ("no content!"). "); } }); } }); })
Mobile Web drop-down loading