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

Function shift

src/js/components/Move/Move.ts:157–162  ·  view source on GitHub ↗

* Adds or subtracts the slider width to the provided position. * * @param position - A position to shift. * @param backwards - Determines whether to shift the slider backwards or forwards. * * @return The shifted position.

( position: number, backwards: boolean )

Source from the content-addressed store, hash-verified

155 * @return The shifted position.
156 */
157 function shift( position: number, backwards: boolean ): number {
158 const excess = position - getLimit( backwards );
159 const size = sliderSize();
160 position -= orient( size * ( ceil( abs( excess ) / size ) || 1 ) ) * ( backwards ? 1 : -1 );
161 return position;
162 }
163
164 /**
165 * Cancels transition.

Callers 3

moveFunction · 0.85
loopFunction · 0.85
canShiftFunction · 0.85

Calls 3

getLimitFunction · 0.85
sliderSizeFunction · 0.85
orientFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…