<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body >
<div id="divId" style="background:#f00; height:1000px; overflow:hidden;">
<div style="height:1500px;"></div>
</div>
<script type="text/javascript">
window.onscroll = function () {
var a = document.documentElement.scrollTop == 0 ? document.body.clientHeight : document.documentElement.clientHeight;
var b = document.documentElement.scrollTop == 0 ? document.body.scrollTop : document.documentElement.scrollTop;
var c = document.documentElement.scrollTop == 0 ? document.body.scrollHeight : document.documentElement.scrollHeight;
if (b != 0) {
if (a + b == c) {
showmore();
}
}
}
function showmore() {
//alert($('#divId div:last-child').offset().top + parseInt($('#divId div:last-child').height()));
if(parseInt($('#divId').height()) < ($('#divId div:last-child').offset().top + parseInt($('#divId div:last-child').height()))) {
$('#divId').css('height', '+=100px');
}
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body >
<div id="divId" style="background:#f00; height:1000px; overflow:hidden;">
<div style="height:1500px;"></div>
</div>
<script type="text/javascript">
window.onscroll = function () {
var a = document.documentElement.scrollTop == 0 ? document.body.clientHeight : document.documentElement.clientHeight;
var b = document.documentElement.scrollTop == 0 ? document.body.scrollTop : document.documentElement.scrollTop;
var c = document.documentElement.scrollTop == 0 ? document.body.scrollHeight : document.documentElement.scrollHeight;
if (b != 0) {
if (a + b == c) {
showmore();
}
}
}
function showmore() {
//alert($('#divId div:last-child').offset().top + parseInt($('#divId div:last-child').height()));
if(parseInt($('#divId').height()) < ($('#divId div:last-child').offset().top + parseInt($('#divId div:last-child').height()))) {
$('#divId').css('height', '+=100px');
}
}
</script>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货