Waypoint.viewportWidth()

Parameters

None.

Returns

The width of the window in px.

This is a convenience method for retrieving the width of the window. Unlike its viewportHeight complement, this method does not need to work around iOS inconsistencies.

$('button.show-viewport-width').on('click', function() {
  notify('Viewport Width: ' + Waypoint.viewportWidth())
})

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

offset: function() {
  return Waypoint.viewportWidth() - this.element.clientwidth
}