I need a method to get the effective height of the browser window. By saying effective, I mean the area which the user actually can see.
So for example it should take into count that most mobile browsers place a "floating" navigation bar and/or a "floating" bottom button bar on the browser window, which for example can mess up $(window).height()
, as it will show the total height, excluding these bars.
My scenario is the following: I need a "full-screen" dialog window which has a header, a footer and a body part between them. In case when the dialog body contains longer content, I would like the dialog body to scroll (instead of the whole document), and the header/footer to stay in the effective viewport, so that for example buttons in the footer would be always visible.
So far I haven't found a good solution to this. I've tried to tweak the Bootstrap Modal and all I could reach is a scrollable modal-body
. It works great on desktop, but when I calculate the max-height
of the modal-body
from window height, I meet the issue on mobile browsers because the top (and/or bottom) bars will break the layout, and footer buttons slide under the bottom bar, or out of the viewport.