MCPcopy
hub / github.com/Splidejs/splide / scroll

Function scroll

src/js/components/Controller/Controller.ts:152–158  ·  view source on GitHub ↗

* Scrolls the slider to the specified destination with updating indices. * * @param destination - The position to scroll the slider to. * @param duration - Optional. Specifies the scroll duration. * @param snap - Optional. Whether to snap the slider to the closest slide or not.

( destination: number, duration?: number, snap?: boolean, callback?: AnyFunction )

Source from the content-addressed store, hash-verified

150 * @param callback - Optional. A callback function invoked after scroll ends.
151 */
152 function scroll( destination: number, duration?: number, snap?: boolean, callback?: AnyFunction ): void {
153 Components.Scroll.scroll( destination, duration, snap, () => {
154 const index = loop( Move.toIndex( getPosition() ) );
155 setIndex( omitEnd ? min( index, endIndex ) : index );
156 callback && callback();
157 } );
158 }
159
160 /**
161 * Parses the control and returns a slide index.

Callers 1

scroll.test.tsFile · 0.50

Calls 5

getPositionFunction · 0.85
setIndexFunction · 0.85
loopFunction · 0.70
scrollMethod · 0.65
toIndexMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…