3

I have a html page like the following model,

when user is scrolling the page, how to I calculate the height of visible part of the #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)   |
 |                                                  |
 |                                                  |
 |                                                  |
 |                                                  |
 |                                                  |
 ____________________________________________________
Jasper
  • 2,314
  • 3
  • 26
  • 33
  • 2
    I think this has what you are looking for: http://stackoverflow.com/questions/12868287/get-height-of-visible-portion-of-div – Smern Apr 06 '13 at 03:13

1 Answers1

1

you can get the height of the outermost window by using window.top in the jQuery. The height of window.top will get the height of the browser window or iframe inside it.

$(window.top).height();
Akshaya Raghuvanshi
  • 2,237
  • 22
  • 21