简体   繁体   中英

Infinite scroll for mobile phone using Javascript and Ajax

I want to implement infinite scroll for the mobile website. I want to find a plugin for this which uses JS,PHP and Ajax.

Also it should have show more for scroll like the one in Google Images Search.

Thanks in Advance!!

you can find one here PS: jQuery runs fine with smartphones so i guess this should work fine for you.

Edit

Works perfect in a Windows Phone 7.5

Got a code :

<html>
   <body>
   <div id="test">scroll to understand</div>
   <div id="wrapper" style="height: 400px; overflow: auto;">
   <div id="content"> </div>
   </div>
   <script language="JavaScript">
   var more = '<div style="height: 1000px; background: #EEE;"></div>';
   var wrapper = document.getElementById("wrapper");
   var content = document.getElementById("content");
  var test = document.getElementById("test");
  content.innerHTML = more;

  function addEvent(obj,ev,fn) {
if(obj.addEventListener) obj.addEventListener(ev,fn,false);
else if(obj.attachEvent) obj.attachEvent("on"+ev,fn);    
 }

 function scroller() {
test.innerHTML = wrapper.scrollTop+"+"+wrapper.offsetHeight+"+100>"+content.offsetHeight;
if(wrapper.scrollTop+wrapper.offsetHeight+100>content.offsetHeight) content.innerHTML+= more;
}

addEvent(wrapper,"scroll",scroller);
</script>
</body>
</html>

But instead of this i want scroll to happen at the end of page as this jquery condition this..How to do this in javaScript ?

$(window).scrollTop() == $(document).height() - $(window).height()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM