The MozScrolledAreaChanged event is fired when the document view has been scrolled or resized.
Note: While you can poll the values of document.scrollWidth and document.scrollHeight to watch for changes to the document size, reading these properties can trigger document reflow, which can make them computationally expensive. This event, introduced in Gecko 1.9.2, is fired whenever either or both of these values change.
| Specification | Mozilla specific |
|---|---|
| Interface | UIEvent |
| Bubbles | Yes |
| Cancelable | Yes |
| Target | DefaultView, Document |
| Default Action | None |
Properties
| Property | Type | Description |
|---|---|---|
targetRead only |
EventTarget |
The event target (the topmost target in the DOM tree). |
typeRead only |
DOMString |
The type of event. |
bubblesRead only |
Boolean |
Whether the event normally bubbles or not. |
cancelableRead only |
Boolean |
Whether the event is cancellable or not. |
viewRead only |
WindowProxy |
document.defaultView (window of the document) |
detailRead only |
long (float) | 0. |
widthRead only |
long (int) | The width of the visible region of the document. |
heightRead only |
long (int) | The height of the visible region of the document. |
xRead only |
long (int) | The X coordinate of the left edge of the visible region of the document. |
yRead only |
long (int) | The Y coordinate of the top edge of the visible region of the document. |
Example
document.addEventListener("MozScrolledAreaChanged", event => {
// find something useful to do with those values
event.width;
event.height;
event.x;
event.y;
}, false);
