手机端滑动至底部时自动加载内容

//滚动至底部时自动加载
var page = 1;
$(window).scroll(function(){
  var scrollTop = $(this).scrollTop();
  var scrollHeight = $(document).height();
  var windowHeight = $(this).height();
  if(scrollTop + windowHeight >= scrollHeight-550){
      //加载数据
        $.ajax({url:"/index.php?c=product&a=productlist&json=true&cid={$Think.get.cid}&p="+page, async: false, success:function(re){
            for (var i = re.length - 1; i >= 0; i--) {
               $('#conlist').append('');
            }
            if(undefined == re[0]){
                layer.msg('不要再滑了,没有了!');
            };
            
        }});
        page++;

  }
});

你可能感兴趣的:(笔记,前端开发)