@twistedandy/better-carousel 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <p>A small, fast and accessible JavaScript carousel.<br />The CSS sets the layout, and the motion runs on the compositor, also on slow phones.</p>
6
6
 
7
- [![Gzip size](https://flat.badgen.net/static/gzip/11.6%20KB/green)](dist/better-carousel.min.js)
7
+ [![Gzip size](https://flat.badgen.net/static/gzip/12.4%20KB/green)](dist/better-carousel.min.js)
8
8
  [![MIT license](https://flat.badgen.net/static/license/MIT/purple)](LICENSE)
9
9
  [![No dependencies](https://flat.badgen.net/static/dependencies/0/blue)](package.json)
10
10
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  - **Layout from CSS** - Your CSS sets the sizes of the slides, the space between them, the axis and the alignment. One carousel can show 1 slide on a phone and 4 slides on a desktop.
18
18
  - **Smooth** - Each motion is a Web Animations API animation of `translate`. No script runs on each frame, also during the auto scroll.
19
- - **Small** - <!-- generated:gzip -->11.6 KB<!-- /generated --> gzip with loop, autoplay, auto scroll, auto height, sync and the mouse wheel.
19
+ - **Small** - <!-- generated:gzip -->12.4 KB<!-- /generated --> gzip with loop, autoplay, auto scroll, auto height, sync and the mouse wheel.
20
20
  - **Loop** - The loop moves the original slides. It adds clones only if the slides are too few.
21
21
  - **Vertical and grid** - A column layout makes a vertical carousel. A CSS grid with more rows also works.
22
22
  - **Accessible** - WCAG 2.1 AA: names for the carousel, the slides and the buttons, the keyboard focus, a live region and reduced motion.
@@ -29,13 +29,13 @@ Load the minified script and the stylesheet from jsDelivr. The script adds the g
29
29
  ```html
30
30
  <link
31
31
  rel="stylesheet"
32
- href="https://cdn.jsdelivr.net/gh/TwistedAndy/better-carousel@v1.0.0/dist/better-carousel.css"
32
+ href="https://cdn.jsdelivr.net/gh/TwistedAndy/better-carousel@v1.1.1/dist/better-carousel.css"
33
33
  integrity="sha384-3ROtqpAC1ZPhSpDul73SGiTOv1L5kTr/08sUr6FPY6S79RIDi7mpI22ttbuxI/w8"
34
34
  crossorigin="anonymous"
35
35
  />
36
36
  <script
37
- src="https://cdn.jsdelivr.net/gh/TwistedAndy/better-carousel@v1.0.0/dist/better-carousel.min.js"
38
- integrity="sha384-c07capt5gSP/u/29MrkOEgCGW7Igro6cgxxf+xcsoNU8vmYtVkOELryyxkxbLe9i"
37
+ src="https://cdn.jsdelivr.net/gh/TwistedAndy/better-carousel@v1.1.1/dist/better-carousel.min.js"
38
+ integrity="sha384-iAm/5iXDxHA5oHmRJqH1xjWnZzqQsmfklYM5v0iVGvJx/3cWrzFZ67xjIHyTVIz1"
39
39
  crossorigin="anonymous"
40
40
  ></script>
41
41
  ```
@@ -127,7 +127,7 @@ The library puts the container into a viewport and a root. Then it adds the arro
127
127
  | Snap | A position where the carousel can stop. A snap shows one slide or a group of slides. |
128
128
  | Selected snap | The snap that shows now. `selectedSnap()` gives its index. |
129
129
  | Selected slide | The slide at the selected snap. It gets the `selected` class. `selectedSlide()` gives its index. |
130
- | Clone | A copy of a slide that the loop adds when the slides are too few. Clones are not in `slideNodes()`, and they have no index. |
130
+ | Clone | A copy of a slide that the loop adds when the slides are too few. Clones are not in `slideNodes()`, and they have no index. A change in the content of a slide also changes its clones. |
131
131
  | Motion | A change of position with an animation. When a motion stops, the `settle` event occurs. |
132
132
  | Fit | All slides show in the viewport. The carousel does not move, and it does not show the arrows and the dots. |
133
133
 
@@ -150,8 +150,9 @@ The library does not set the size of the slides or the space between them. It re
150
150
  | `justify-content: flex-end` | The selected slide is at the end |
151
151
  | The margins of the slides and a negative margin of the container | The space between the slides. In a loop, also the space between the last slide and the first slide. |
152
152
  | `direction: rtl` | A right-to-left carousel |
153
+ | The padding of the viewport | The snaps align to the inner edge of the padding. The padding shows parts of the slides next to the selected slide. |
153
154
 
154
- The carousel measures again when the CSS changes, when the page adds or removes a slide, and when an image loads. To add or remove a slide, change the elements in the container.
155
+ The carousel measures again when the CSS changes, when the page adds or removes a slide, and when an image loads. A slide with `display: none` gets no snap. The `template`, `script` and `style` elements in the container are not slides. A CSS `scale` or `rotate` on a parent, such as the open animation of a modal window, does not change the snaps. To add or remove a slide, change the elements in the container.
155
156
 
156
157
  A carousel can start in a hidden element, such as a tab, an accordion or a modal window. It has no size, so it shows no arrows and no dots. When the element shows, the carousel measures and starts to move.
157
158
 
@@ -389,7 +390,7 @@ The autoplay pauses in these conditions:
389
390
  - The tab is hidden.
390
391
  - The carousel is out of view.
391
392
 
392
- If the user prefers reduced motion, the autoplay does not start. These are the default values:
393
+ If the user prefers reduced motion, the autoplay does not start. A breakpoint change keeps the play state: a stopped autoplay stays stopped. These are the default values:
393
394
 
394
395
  ```js
395
396
  BetterCarousel(element, {
@@ -425,7 +426,7 @@ An animation of `scale`, `translate` or `opacity` runs on the compositor: no scr
425
426
 
426
427
  ### autoScroll
427
428
 
428
- The value is `true`, a speed in px/s, or an object. The motion is one animation on the compositor. The pause conditions are the same as for the autoplay. These are the default values:
429
+ The value is `true`, a speed in px/s, or an object. The motion is one animation on the compositor. The pause conditions are the same as for the autoplay. A press on the slides also stops them. If the pointer does not drag, the motion starts again after `startDelay`. These are the default values:
429
430
 
430
431
  ```js
431
432
  BetterCarousel(element, {
@@ -717,9 +718,9 @@ The library is made for slow phones. A motion runs on the compositor, and a caro
717
718
  <!-- generated:sizes -->
718
719
  | File | Minified | Gzip | Brotli |
719
720
  | --- | --- | --- | --- |
720
- | `better-carousel.min.js` | 28.9 KB | 11.6 KB | 10.6 KB |
721
+ | `better-carousel.min.js` | 30.3 KB | 12.4 KB | 11.4 KB |
721
722
  | `better-carousel.css` | 4.7 KB | 1.3 KB | 1.1 KB |
722
- | Total | 33.6 KB | 12.9 KB | 11.7 KB |
723
+ | Total | 35.0 KB | 13.8 KB | 12.5 KB |
723
724
  <!-- /generated -->
724
725
 
725
726
  The [Comparison](#comparison) section gives the sizes and the runtime costs of other carousel libraries.