Waypoint.viewportHeight()

Parameters

None.

Returns

The height of the window in px.

This is a convenience method for retrieving the height of the window. It also works around inconsistencies in iOS with window height reporting when the URL bar is present on screen.

$('button.show-viewport-height').on('click', function() {
  notify('Viewport Height: ' + Waypoint.viewportHeight())
})

This method often comes in handy when writing function offsets. For example, if your waypoint has the default context of window, the bottom-in-view alias works out to be the following function offset:

offset: function() {
  return Waypoint.viewportHeight() - this.element.clientHeight
}