SnapEvent Class

The event fired at a scroll snap container (or at the document for the viewport) when the snap targets it snaps to change (scrollsnapchanging, when a scroll operation starts) or changed (scrollsnapchange, when a scroll operation is completed or after a layout change) (https://drafts.csswg.org/css-scroll-snap-2/#snap-events).

public sealed class SnapEvent : Event
Inheritance
Event SnapEvent

Constructors

NameDescription
SnapEvent(string, SnapEventInit?)Creates an event with the given type and initialization dictionary.

SnapEvent(string, SnapEventInit?)

SnapEvent.cs

Creates an event with the given type and initialization dictionary.

public SnapEvent(string type, SnapEventInit? eventInitDict = null)

Properties

NameDescription
SnapTargetBlockGets the element the snap container is snapped to in the block axis (the element of a pseudo-element), or null when it is not snapped in that axis (https://drafts.csswg.org/css-scroll-snap-2/#dom-snapevent-snaptargetblock).
SnapTargetInlineGets the element the snap container is snapped to in the inline axis (https://drafts.csswg.org/css-scroll-snap-2/#dom-snapevent-snaptargetinline): see SnapEvent.SnapTargetBlock.

SnapTargetBlock

SnapEvent.cs

Gets the element the snap container is snapped to in the block axis (the element of a pseudo-element), or null when it is not snapped in that axis (https://drafts.csswg.org/css-scroll-snap-2/#dom-snapevent-snaptargetblock).

public Node? SnapTargetBlock { get; }

SnapTargetInline

SnapEvent.cs

Gets the element the snap container is snapped to in the inline axis (https://drafts.csswg.org/css-scroll-snap-2/#dom-snapevent-snaptargetinline): see SnapEvent.SnapTargetBlock.

public Node? SnapTargetInline { get; }