mozilla
Your Search Results

    Detecting document width and height changes

    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.

    General info

    Specification
    None, Mozilla specific
    Interface
    UIEvent
    Bubbles
    Yes
    Cancelable
    Yes
    Target
    DefaultView, Document
    Default Action
    None.

    Properties

    Property Type Description
    target Read only EventTarget The event target (the topmost target in the DOM tree).
    type Read only DOMString The type of event.
    bubbles Read only boolean Does the event normally bubble?
    cancelable Read only boolean Is it possible to cancel the event?
    view Read only WindowProxy document.defaultView (the window of the document).
    detail Read only long (float) 0.
    width Read only long (int) The width of the visible region of the document.
    height Read only long (int) The height of the visible region of the document.
    x Read only long (int) The X coordinate of the left edge of the visible region of the document.
    y Read only long (int) The Y coordinate of the top edge of the visible region of the document.

     

    Example

    document.addEventListener("MozScrolledAreaChanged", function( event ) {
        // find something useful to do with those values
        event.width;
        event.height;
        event.x;
        event.y;
    
    }, false);

    Document Tags and Contributors

    Tags: 
    Contributors to this page: Sheppy, robin_reala, louisremi
    Last updated by: louisremi,