---
title: "jquery滚轮滚动到页面底部异步加载数据"
author: "kt431128"
date: "2013-12-30T18:00:53Z"
tags: []
categories: ["Web前端"]
slug: "jquery"
draft: false
lastmod: "2013-12-30T18:04:47Z"
id: 1997445
url: "https://kt431128.iteye.com/blog/1997445"
---

var totalheight = 0;  

function loadData(){ 

            totalheight = parseFloat(jQuery(window).height()) + parseFloat(jQuery(window).scrollTop());  

 

            if (jQuery(document).height() &lt;= totalheight) {  

 

                     jQuery.post("",{},function(data){

                 if(data!=null && data.trim()!=""){

                                              if(count%4==0){

                                              jQuery(".chapter\_content").html(data);

                                                                     }else{

                                                                        jQuery(".chapter\_content").append(data);

                                                                            }

                                                               }

                                              });

                                                 }

                                                    }

 

jQuery(document).ready(

               function(){

                     jQuery(window).scroll( function() { 

                                    loadData();

                               }); 

                         });