日期:2014-05-17 浏览次数:20815 次
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>div</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('div').scroll(function(){ var nScrollHeight = $(this)[0].scrollHeight;; var nScrollTop = $(this)[0].scrollTop; var nDivHeight = $(this).innerHeight(); if(nScrollTop + nDivHeight >= nScrollHeight){ alert("aaa"); } }); }); </script> </head> <body> <div style = 'OVERFLOW: auto; HEIGHT: 280px'> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> </div> </body> </html>
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>div</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('div').scroll(function(){ var nScrollHeight = $(this)[0].scrollHeight;; var nScrollTop = $(this)[0].scrollTop; var nDivHeight = $(this).innerHeight(); if(nScrollTop + nDivHeight >= nScrollHeight){ //alert("aaa"); $('#a').html(function(){ return +this.innerHTML + 1; }) return false; } }); }); </script> </head> <body> <div id="a">0</div> <div style = 'OVERFLOW: auto; HEIGHT: 280px'> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> <p>1111</p> </div> </body> </html>