jquery滚轮滚动到页面底部异步加载数据

var totalheight = 0;  

function loadData(){ 

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

 

            if (jQuery(document).height() <= 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();

                               }); 

                         });

你可能感兴趣的:(jquery)