[英]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. 我想为此找到一个使用JS,PHP和Ajax的插件。
Also it should have show more for scroll like the one in Google Images Search. 同样,它应该显示更多滚动内容,例如Google图片搜索中的滚动内容。
Thanks in Advance!! 提前致谢!!
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
? 但是,除了这个,我希望滚动发生在页面末尾,因为这个jquery
条件是this ..如何在javaScript
做到这一点?
$(window).scrollTop() == $(document).height() - $(window).height()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.