# Snappy-Carousel
Snappy is yet another carousel library.
Its goal is to be as lightweight and performant as possible.
It does not implement every feature found in other carousel libraries. Instead, it relies on native CSS scroll snapping and adds as little on top as possible.
Mouse-drag behavior closely follows native touch scrolling in the browser, including inertia and snapping to a slide. Thus dragging with the mouse feels pretty identical to native scrolling on a touch device or using a trackpad.
| File | Size | gzip |
| ---------- | ------: | -----: |
| snappy.js | 7.5k kB | 2.2 KB |
| snappy.css | 0.9 B | 0.4 KB |
## Usage
### Only CSS for a basic scroll container
You can use Snappy without JavaScript. This gives you a simple CSS-only scroll container with snapping slides.
```html
Carousel Heading
1
2
...
```
Snappy is mostly unstyled, leaving the appearance up to you.
For inspiration, see the [complete example](index.html).
### Options
https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Scroll_snap
add data attribites to the carousel container to change the default behavior:
```html
Carousel Heading
1
2
...
```
### Add JavaScript for a carousel
Including the JavaScript adds the following features:
- Previous and next buttons
- Pagination
- Mouse dragging
```html
Carousel Heading
1
2
...
```
## Development
Install the development dependencies and build the minified JavaScript and CSS files into `dist`:
```sh
npm install
npm run build
```
To rebuild the files whenever a source file changes, run:
```sh
npm run watch
```