码迷,mamicode.com
首页 > 移动开发 > 详细

手机页面滚动到底部刷新数据

时间:2017-01-07 00:19:01      阅读:1126      评论:0      收藏:0      [点我收藏+]

标签:color   document   app   pre   /var   height   news   log   底部   

 1 //滚动到底部加载数据
 2 $(window).scroll(function () {
 3     var scrollTop = $(this).scrollTop();
 4     var elementHeight = $(this).height();
 5     var h1 = scrollTop + elementHeight;
 6     var scrollHeight = document.documentElement.scrollHeight;
//var documentHeight = $(document).height();
7 if (h1 >= scrollHeight) { 8 var pageIndex = $("#hidPageIndex").val(); 9 AppendNews(pageIndex); //加载新数据 10 } 11 });

 

技术分享

 

说明:

document.documentElement.scrollHeight 等效于  $(document).height()

 

手机页面滚动到底部刷新数据

标签:color   document   app   pre   /var   height   news   log   底部   

原文地址:http://www.cnblogs.com/miaosha5s/p/6257480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!