2
我有一個像以下模型的HTML頁面,如何計算可見的高度?
當用戶正在滾動頁面時,如何計算#page1的可見部分的高度?
-------------------------------------------------------
#heder (position: fixed; height: 100px, z-index: 10)
-------------------------------------------------------
visible zone
____________________________________________________
| |
| #page1 (visible) |
| |
| (position: static; height: 1000px, z-Index: 0) |
| |
-------------------------------------------------------
#footer (position: fixed; height: 50px, z-index: 10)
-------------------------------------------------------
| |
| |
| |
| |
| #page1 (invisible) |
| |
| |
| |
| |
____________________________________________________
| |
| |
| |
| #page2 (invisible) |
| |
| (position: static; height: 700px, z-Index: 0) |
| |
| |
| |
| |
| |
____________________________________________________
我認爲這有你在找什麼:http://stackoverflow.com/questions/12868287/get-height-of-visible-portion-of-div – smerny 2013-04-06 03:13:22