Scroll Docs

The Scroll library provides a uniform API across the various browsers for determining the number of pixels by which the page has been scrolled.

Include this library if you want to use FORK.Event.pageX() or FORK.Event.pageY() and want FORK.Event.isSupported() to potentially return true.

API

isSupported()

Determine if page scroll reporting is supported by the browser. Returns true if so and false otherwise.

In some modes, Internet Explorer uses the document's body element to determine the amount by which a page has been scrolled. Therefore it is important to know that the document's body element has been parsed by the browser before calling this function.

Examples

if (FORK.Scroll.isSupported()) {
  alert(FORK.Scroll.getX());
} else {
  alert('Your browser is not capable of reporting scroll.');
}

getX()

Returns the number of pixels by which the the page has been scrolled horizontally. If the particular browser is incapable of determining this value then NaN is returned. I don't know of a browser with the advanced event capabilities required by the event library that will return NaN.

Examples

FORK.Scroll.getX();

getY()

Analogous to getX.

Credits

Code adapted from Richard Cornford's feature detection article