Simple implementation of the phone pull-up load more, by triggering the trigger () event, triggering the original already written request
CSS Styles
. more { padding: 10px 10px; height:50px; background:#fff; background-clip:content-box; text-align: Center; line-height:50px; font-family:"Microsoft Yahei"; display: none; }
HTML code
<class= "More" data-page= "1" data-rname= "" > load More </div>
JS Code
1 /**2 * Achieve scrolling effect3 */4$(function(){5 varClienth = $ (window). Height ();//Screen Height6 varH =$ (document). Height ()-$ (window). scrolltop ();7 varTimer =NULL;8$ (window). On ("Touchmove",function(){9 varSCROLLH =$ (document). Height ();TenH = scrollh-$ ( This). scrolltop (); One if(Clienth >=h) { A$ (". More"). Show (); -Timer = SetTimeout (function(){ -$ (". more"). HTML ("Release load"); the}, 1000); -}Else if(Clienth >= h-$ (". More"). Height ()) { - -$ (". more"). HTML ("load More"); +$ (". More"). Hide (); - } + }); A //record start press down to release time at - varStartTime, EndTime; -$ (window). On ("Touchstart",function(event) { -StartTime =NewDate (). GetTime (); -$ (". more"). HTML ("load More"); - }); in$ (window). On ("Touchend",function(event) { -H =$ (document). Height ()-$ (window). scrolltop (); to if(Clienth >=h) { +EndTime =NewDate (). GetTime (); - if(Endtime-starttime > 900){ the$ (". more"). Trigger ("click")); *$ (". More"). Show (); $$ (". more"). html ("Loading ...");Panax Notoginseng}Else{ - cleartimeout (timer); the$ (". more"). HTML ("load More"); +$ (". More"). Hide (); A the } +}Else{ - cleartimeout (timer); $$ (". more"). HTML ("load More"); $$ (". More"). Hide (); - - } the - });Wuyi});
javascript--add more controls on a jquery-based imitation mobile-side pull-up