手机端网页苹果/安卓滑动翻页,未触发事件解决办法
针对,手机端H5网页滑动触发事件,未触发解决办法
<script type="text/javascript">
var page = 2;
var dataUrl = "/i/cost/costpage";
var busying = false;
$(window).scroll(function () {
//var topOffset = $(window).scrollTop();
//var bodWith = $(window).height();
//var htmHeig = $("html").height();
//if (((topOffset == htmHeig - bodWith - 1) || (topOffset == htmHeig - bodWith)) && busying == false) {
var topOffset = $(document).scrollTop();
var bodWith = $(window).height();
var htmHeig = $(document).height();
if ((htmHeig - (bodWith + topOffset) <= 150) && busying == false) {
busying = true;
$(".cost-list").append("<div class='loading'><img src='/content/images/loading.gif' alt='' /></div>");
$.get(dataUrl, { page: page }, function (data) {
$(".loading").remove();
if (data == false) {
$(".cost-list").append("<div class=\"cost-list-li\" style=\"text-align:center;\"><h3>没有更多了</h3></div>");
return false;
}
$(".cost-list").append(data);
page++;
busying = false;
});
}
});
</script>