VisualViewport


How to use the VisualViewport class of the bit Butil?

Usage
To use the browser VisualViewport features you need to inject the Bit.Butil.VisualViewport class and use it like this:
@inject Bit.Butil.VisualViewport visualViewport

@code {
    var offsetLeft = await VisualViewport.GetOffsetLeft();
}
Methods

GetOffsetLeft:
Returns the offset of the left edge of the visual viewport from the left edge of the layout viewport in CSS pixels, or 0 if current document is not fully active. (MDN).



GetOffsetTop:
Returns the offset of the top edge of the visual viewport from the top edge of the layout viewport in CSS pixels, or 0 if current document is not fully active. (MDN).



GetPageLeft:
Returns the x coordinate of the left edge of the visual viewport relative to the initial containing block origin, in CSS pixels, or 0 if current document is not fully active. (MDN).



GetPageTop:
Returns the y coordinate of the top edge of the visual viewport relative to the initial containing block origin, in CSS pixels, or 0 if current document is not fully active. (MDN).



GetWidth:
Returns the width of the visual viewport, in CSS pixels, or 0 if current document is not fully active. (MDN).



GetHeight:
Returns the height of the visual viewport, in CSS pixels, or 0 if current document is not fully active. (MDN).



GetScale:
Returns the pinch-zoom scaling factor applied to the visual viewport, or 0 if current document is not fully active, or 1 if there is no output device. (MDN).



AddResize, RemoveResize:
Fired when the visual viewport is resized. (MDN).


AddScroll, RemoveScroll:
Fired when the visual viewport is scrolled. (MDN).