ResizeObserver Class
Observes the size changes of the boxes of elements (https://drafts.csswg.org/resize-observer-1/#resize-observer-interface). The observations are determined and delivered by the rendering steps of the event loop, after the layout (https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering), so only the elements of the documents of a BrowsingContext are observed.
public sealed class ResizeObserverConstructors
| Name | Description |
|---|---|
| ResizeObserver(ResizeObserverCallback) | Creates an observer that invokes the callback with the entries of the observed elements whose size changed. The observer belongs to the associated document of the current global object (the [[resizeObservers]] of the document, whose rendering steps deliver the notifications), or, without a current global object, to the document of the first observed element. |
ResizeObserver(ResizeObserverCallback)
ResizeObserver.csCreates an observer that invokes the callback with the entries of the observed elements whose size changed. The observer belongs to the associated document of the current global object (the [[resizeObservers]] of the document, whose rendering steps deliver the notifications), or, without a current global object, to the document of the first observed element.
public ResizeObserver(ResizeObserverCallback callback)Methods
| Name | Description |
|---|---|
| Disconnect() | Stops observing all the elements (https://drafts.csswg.org/resize-observer-1/#dom-resizeobserver-disconnect). |
| Observe(Element, ResizeObserverOptions?) | Starts observing the size of an element, or changes the observed box of an observed element (https://drafts.csswg.org/resize-observer-1/#dom-resizeobserver-observe). |
| Unobserve(Element) | Stops observing the size of an element (https://drafts.csswg.org/resize-observer-1/#dom-resizeobserver-unobserve). |
Disconnect()
ResizeObserver.csStops observing all the elements (https://drafts.csswg.org/resize-observer-1/#dom-resizeobserver-disconnect).
public void Disconnect()Observe(Element, ResizeObserverOptions?)
ResizeObserver.csStarts observing the size of an element, or changes the observed box of an observed element (https://drafts.csswg.org/resize-observer-1/#dom-resizeobserver-observe).
public void Observe(Element target, ResizeObserverOptions? options = null)Parameters
targetElement- The element to observe.
optionsResizeObserverOptions?- The box to observe (the content box by default).
See also
Unobserve(Element)
ResizeObserver.csStops observing the size of an element (https://drafts.csswg.org/resize-observer-1/#dom-resizeobserver-unobserve).