Classdesc

Mostly CSS slider with great performance.

Constructors

Properties

element: HTMLElement

Base element of this slider

plugins: Map<string, ScrollSnapPlugin>

additional behaviour

removeEventListener: {
    <K>(type, listener, options?): void;
    (type, listener, options?): void;
}

Type declaration

    • <K>(type, listener, options?): void
    • Type Parameters

      • K extends keyof HTMLElementEventMap

      Parameters

      • type: K
      • listener: ((this, ev) => any)
          • (this, ev): any
          • Parameters

            • this: HTMLElement
            • ev: HTMLElementEventMap[K]

            Returns any

      • Optional options: boolean | EventListenerOptions

      Returns void

      Inherit Doc

    • (type, listener, options?): void
    • Parameters

      • type: string
      • listener: EventListenerOrEventListenerObject
      • Optional options: boolean | EventListenerOptions

      Returns void

      Inherit Doc

Inherit Doc

addEventListener: {
    <K>(type, listener, options?): void;
    (type, listener, options?): void;
}

Type declaration

    • <K>(type, listener, options?): void
    • Type Parameters

      • K extends keyof HTMLElementEventMap

      Parameters

      • type: K
      • listener: ((this, ev) => any)
          • (this, ev): any
          • Parameters

            • this: HTMLElement
            • ev: HTMLElementEventMap[K]

            Returns any

      • Optional options: boolean | AddEventListenerOptions

      Returns void

      Inherit Doc

    • (type, listener, options?): void
    • Parameters

      • type: string
      • listener: EventListenerOrEventListenerObject
      • Optional options: boolean | AddEventListenerOptions

      Returns void

      Inherit Doc

Inherit Doc

roundingMethod: ((value) => number)

Rounding method used to calculate the current slide (e.g. Math.floor, Math.round, Math.ceil, or totally custom.)

Type declaration

    • (value): number
    • Rounding method used to calculate the current slide (e.g. Math.floor, Math.round, Math.ceil, or totally custom.)

      Parameters

      • value: number

        factor indicating th current position (e.g "0" for first slide, "2.5" for third slide and a half)

      Returns number

      f(x) - integer factor indicating the currently 'active' slide.

Param: value

factor indicating th current position (e.g "0" for first slide, "2.5" for third slide and a half)

Returns

f(x) - integer factor indicating the currently 'active' slide.

scrollTimeout: number

Timeout delay in milliseconds used to catch the end of scroll events

itemSize: number

Calculated size of a single item

sizingMethod: ((slider, entries?) => number)

Computes a single number representing the slides widths. By default, this will use the first slide's offsetWidth. Possible values could be an average of all slides, the min or max values, ...

Type declaration

    • (slider, entries?): number
    • Computes a single number representing the slides widths. By default, this will use the first slide's offsetWidth. Possible values could be an average of all slides, the min or max values, ...

      Parameters

      • slider: ScrollSnapSlider

        current slider

      • Optional entries: ResizeObserverEntry[]

        resized entries

      Returns number

      integer size of a slide in pixels

Param: slider

current slider

Param: entries

resized entries

Returns

integer size of a slide in pixels

slide: number

Active slide

resizeObserver: ResizeObserver

Resize observer used to update item size

scrollTimeoutId: number

Timeout ID used to catch the end of scroll events

slideScrollLeft: number

Active slide's scrollLeft in the containing element

Methods

  • Calculate all necessary things and dispatch an event when sliding stops

    Returns void

  • This will recompute the itemSize

    Parameters

    • Optional entries: ResizeObserverEntry[]

      Optional entries delivered from a ResizeObserver

    Returns void

  • Dispatches an event on the slider's element

    Parameters

    • event: string
    • detail: unknown

    Returns boolean

Generated using TypeDoc