滚动条滑动到最低端自动加载

直接上案列

<html>
<head>
	<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>

</head>
<body>

<div id="showDiv">
	<img src="http://file110.mafengwo.net/s7/M00/32/04/wKgB6lRHxp-ABbC6AAgsarDLx4U30.jpeg?imageView2%2F2%2Fw%2F600%2Fh%2F600%2Fq%2F90">
	<img src="http://file28.mafengwo.net/M00/32/1F/wKgB6lRHxreAXIJyAAgXM7dCcS881.groupinfo.w600.jpeg">
	<img src="http://file27.mafengwo.net/M00/34/10/wKgB6lRHyDqAfkfEAAaYQOgzqSo70.groupinfo.w600.jpeg">
	<img src="http://file27.mafengwo.net/M00/34/14/wKgB6lRHyD6AAwMOAAYAaiWAJ8g75.groupinfo.w600.jpeg">
	<img src="http://file28.mafengwo.net/M00/34/1F/wKgB6lRHyEeAHZ6VAAb8RZ-8raY18.groupinfo.w600.jpeg">
	<img src="http://file28.mafengwo.net/M00/32/37/wKgB6lRHxsaABWRQAAUlQLQB0S493.groupinfo.w600.jpeg">
</div>

<script>
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(a+b == c){
		//自己的方法
		$("#showDiv").append(""+
				"<img src='http://file27.mafengwo.net/M00/32/38/wKgB6lRHxseACHeeAANa9obRflk05.groupinfo.w600.jpeg'>"+
				"<img src='http://file28.mafengwo.net/M00/1F/47/wKgB6lRI-VGATS2VAAjDIY2hjmg27.groupinfo.w600.jpeg'>"+
				"<img src='http://file28.mafengwo.net/M00/1F/4B/wKgB6lRI-VWAT_k4AAghW3FzzqY56.groupinfo.w600.jpeg'>"+
				"<img src='http://file27.mafengwo.net/M00/1F/50/wKgB6lRI-VmAWJgTAAdC6cI0Tj445.groupinfo.w600.jpeg'>"+
				"<img src='http://file28.mafengwo.net/M00/1F/5B/wKgB6lRI-WCACr_1AAgcxsiJVew23.groupinfo.w600.jpeg'>"+
				"<img src='http://file28.mafengwo.net/M00/1F/69/wKgB6lRI-WeAFZmhAAdpQEcUgO055.groupinfo.w600.jpeg'>"+
			"");
	}
}
</script>
</body>
</html>


你可能感兴趣的:(滚动条滑动到最低端自动加载)