embla-carousel
Advanced tools
Comparing version 2.1.11 to 2.1.12
@@ -1644,3 +1644,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var betweenDistances = distancesBetweenSnaps(); | ||
var bounds = scrollBounds(); | ||
var bounds = viewBounds(); | ||
@@ -1654,3 +1654,3 @@ function distancesBetweenSnaps() { | ||
function snapPosition(index) { | ||
function snapPositionFor(index) { | ||
var sizes = betweenDistances.slice(0, index); | ||
@@ -1662,7 +1662,7 @@ return sizes.reduce(function (a, d) { | ||
function scrollBounds() { | ||
function viewBounds() { | ||
var indexMax = params.index.max; | ||
var endGap = viewSize - snapSizes[indexMax]; | ||
var gapMinusAlign = endGap - alignSizes[indexMax]; | ||
var min = snapPosition(indexMax) + gapMinusAlign; | ||
var min = snapPositionFor(indexMax) + gapMinusAlign; | ||
return limit_1.Limit({ | ||
@@ -1674,3 +1674,3 @@ min: min, | ||
function containScroll(position) { | ||
function containToView(position) { | ||
if (contentFillsUpView) { | ||
@@ -1688,4 +1688,4 @@ var min = bounds.min, | ||
function measure(size, index) { | ||
var position = snapPosition(index); | ||
return params.contain ? containScroll(position) : position; | ||
var position = snapPositionFor(index); | ||
return params.contain ? containToView(position) : position; | ||
} | ||
@@ -1692,0 +1692,0 @@ |
{ | ||
"name": "embla-carousel", | ||
"version": "2.1.11", | ||
"version": "2.1.12", | ||
"author": "David Cetinkaya", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -140,59 +140,108 @@ <br /> | ||
Align the slides relative to the carousel viewport. | ||
⭐ **`demo`** - [`start`](https://codesandbox.io/s/embla-carousel-align-start-5kfhw) · [`center`](https://codesandbox.io/s/embla-carousel-align-center-e8s0w) · [`end`](https://codesandbox.io/s/embla-carousel-align-end-h233r) | ||
<p>Align the slides relative to the carousel viewport.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-align-start-5kfhw"><code>start</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-align-center-e8s0w"><code>center</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-align-end-h233r"><code>end</code></a> | ||
</sup> | ||
##### `containerSelector` <sup>type: string<sup> | ||
A query selector for the container that holds the slides, where all immediate children will be treated as slides. | ||
⭐ **`demo`** - [`*`](https://codesandbox.io/s/embla-carousel-containerselector-yfxll) · [`.my-classname`](https://codesandbox.io/s/embla-carousel-containerselector-my-classname-ntlzb) | ||
<p>A query selector for the container that holds the slides, where all immediate children will be treated as slides.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-containerselector-yfxll"><code>*</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-containerselector-my-classname-ntlzb"><code>.my-classname</code></a> | ||
</sup> | ||
##### `slidesToScroll` <sup>type: number<sup> | ||
Scrolls past given number of slides whether scroll is triggered by the API methods or drag interactions. | ||
⭐ **`demo`** - [`1`](https://codesandbox.io/s/embla-carousel-slidestoscroll-1-ry5y7) · [`2`](https://codesandbox.io/s/embla-carousel-slidestoscroll-2-1g4rk) | ||
<p>Scrolls past given number of slides whether scroll is triggered by API methods or drag interactions.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-slidestoscroll-1-ry5y7"><code>1</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-slidestoscroll-2-1g4rk"><code>2</code></a> | ||
</sup> | ||
##### `containScroll` <sup>type: boolean<sup> | ||
Contains slides to carousel viewport to prevent excessive scrolling at the beginning or end. | ||
⭐ **`demo`** - [`false`](https://codesandbox.io/s/embla-carousel-containscroll-false-jktsn) · [`true`](https://codesandbox.io/s/embla-carousel-containscroll-true-tunvy) | ||
<p>Contains slides to carousel viewport to prevent excessive scrolling at the beginning or end.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-containscroll-false-jktsn"><code>false</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-containscroll-true-tunvy"><code>true</code></a> | ||
</sup> | ||
##### `draggable` <sup>type: boolean<sup> | ||
Allow mouse & touch interactions to scroll the carousel. | ||
⭐ **`demo`** - [`true`](https://codesandbox.io/s/embla-carousel-draggable-true-4prej) · [`false`](https://codesandbox.io/s/embla-carousel-draggable-false-gj9j0) | ||
<p>Allow mouse & touch interactions to scroll the carousel.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-draggable-true-4prej"><code>true</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-draggable-false-gj9j0"><code>false</code></a> | ||
</sup> | ||
##### `dragFree` <sup>type: boolean<sup> | ||
Determines if the carousel should snap to a slide position after mouse & touch interactions. | ||
⭐ **`demo`** - [`false`](https://codesandbox.io/s/embla-carousel-dragfree-false-he5m1) · [`true`](https://codesandbox.io/s/embla-carousel-dragfree-true-bfqjc) | ||
<p>Determines if the carousel should snap to a slide position after mouse & touch interactions.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-dragfree-false-he5m1"><code>false</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-dragfree-true-bfqjc"><code>true</code></a> | ||
</sup> | ||
##### `loop` <sup>type: boolean<sup> | ||
Determines if the carousel should loop when start or end is reached. | ||
⭐ **`demo`** - [`false`](https://codesandbox.io/s/embla-carousel-loop-false-oyols) · [`true`](https://codesandbox.io/s/embla-carousel-loop-true-3x6id) | ||
<p>Determines if the carousel should loop when start or end is reached.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-loop-false-oyols"><code>false</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-loop-true-3x6id"><code>true</code></a> | ||
</sup> | ||
##### `speed` <sup>type: number<sup> | ||
Carousel speed when using buttons to navigate. A higher number will make transitions faster. | ||
⭐ **`demo`** - [`10`](https://codesandbox.io/s/embla-carousel-speed-10-9v4gr) · [`15`](https://codesandbox.io/s/embla-carousel-speed-15-omw5i) | ||
<p>Carousel speed when using API methods to navigate. A higher number will make transitions faster.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-speed-10-9v4gr"><code>10</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-speed-15-omw5i"><code>15</code></a> | ||
</sup> | ||
##### `startIndex` <sup>type: number<sup> | ||
Zero based index of the starting slide when carousel mounts. | ||
⭐ **`demo`** - [`0`](https://codesandbox.io/s/embla-carousel-startindex-0-zpxyn) · [`3`](https://codesandbox.io/s/embla-carousel-startindex-0-3ur20) | ||
<p>Zero based index of the starting slide when carousel mounts.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-startindex-0-zpxyn"><code>0</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-startindex-0-3ur20"><code>3</code></a> | ||
</sup> | ||
##### `selectedClass` <sup>type: string<sup> | ||
Classname that will be applied to the selected slide. | ||
⭐ **`demo`** - [`is-selected`](https://codesandbox.io/s/embla-carousel-selectedclass-is-selected-1h2ts) · [`my-class`](https://codesandbox.io/s/embla-carousel-selectedclass-my-class-ioysh) | ||
<p>Classname that will be applied to the selected slide.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-selectedclass-is-selected-1h2ts"><code>is-selected</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-selectedclass-my-class-ioysh"><code>my-class</code></a> | ||
</sup> | ||
##### `draggableClass` <sup>type: string<sup> | ||
Classname that will be applied to the wrapper when the carousel mounts if draggable. | ||
⭐ **`demo`** - [`is-draggable`](https://codesandbox.io/s/embla-carousel-draggableclass-is-draggable-3eben) · [`my-class`](https://codesandbox.io/s/embla-carousel-draggableclass-my-class-j7r68) | ||
<p>Classname that will be applied to the wrapper when the carousel mounts if draggable.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-draggableclass-is-draggable-3eben"><code>is-draggable</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-draggableclass-my-class-j7r68"><code>my-class</code></a> | ||
</sup> | ||
##### `draggingClass` <sup>type: string<sup> | ||
Classname that will be applied to the wrapper when a pointer is dragging the carousel. | ||
⭐ **`demo`** - [`is-dragging`](https://codesandbox.io/s/embla-carousel-draggingclass-is-dragging-7u90r) · [`my-class`](https://codesandbox.io/s/embla-carousel-draggingclass-my-class-7u90r) | ||
<p>Classname that will be applied to the wrapper when a pointer is dragging the carousel.</p> | ||
<sup> | ||
✨ <strong>Demo</strong> - | ||
<a href="https://codesandbox.io/s/embla-carousel-draggingclass-is-dragging-7u90r"><code>is-dragging</code></a> · | ||
<a href="https://codesandbox.io/s/embla-carousel-draggingclass-my-class-7u90r"><code>my-class</code></a> | ||
</sup> | ||
@@ -199,0 +248,0 @@ ## API |
74763
341