Occurs when the contents or the size of an element is changed and it causes a scrollbar to appear.
The opposite event is the underflow event, which fires when the contents or the size of an element is changed and it causes a scrollbar to disappear. Use the detail property for the overflow and underflow events to identify the scrollbars whose visibility has changed. A value of 0 means the vertical scrollbar, a value of 1 means the horizontal scrollbar and a value of 2 means both the horizontal and vertical scrollbars. To modify the behavior of the scrollbars for an element, use the overflow style property.
How to register:
object.addEventListener ("overflow", handler, useCapture);
This event cannot be registered in HTML.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
Actions that invoke the overflow event:
- Modifying the contents of an element (by script or by the user).
- Changing the width or height of an element (by script or by the user).
Example HTML code 1:
This example illustrates the use of the overflow event.
Did you find this example helpful?
User Contributed Comments