<script type=
"text/javascript"
>
$(document).ready(
function
(){
alert($(window).height());
//瀏覽器時下窗口可視區域高度
alert($(document).height());
//瀏覽器時下窗口文檔的高度
alert($(document.body).height());
//瀏覽器時下窗口文檔body的高度
alert($(document.body).outerHeight(
true
));
//瀏覽器時下窗口文檔body的總高度 包括border padding margin
alert($(window).width());
//瀏覽器時下窗口可視區域寬度
alert($(document).width());
//瀏覽器時下窗口文檔對於象寬度
alert($(document.body).width());
//瀏覽器時下窗口文檔body的高度
alert($(document.body).outerWidth(
true
));
//瀏覽器時下窗口文檔body的總寬度 包括border padding margin
var
win_height=$(window).height();
var
doc_height=$(document).height();
var
scroll_top=$(document).scrollTop();
/*
doc_height是文檔的高度,scroll_top是滾動條上部離文檔頂部的高度,window_height表示窗口高度。
當scroll_top == 0 時,表示滾動條已經到達窗口頂部。
當scroll_top + window_height >= doc_height 時,表示滾動條已經到達窗口底部。
*/
//判斷滾動條是否到達窗口底部
$(window).bind(
'scroll'
,
function
(){
//綁定滾動事件
if
($(document).scrollTop() + $(window).height() >= $(document).height()){
console.log(win_height);
console.log($(document).scrollTop());
console.log(doc_height);
//......
}
});
});
</script>