Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gregolive/img-carousel
A Javascript-powered image carousel/slider.
https://github.com/gregolive/img-carousel
css javascript npm npm-module
Last synced: 18 days ago
JSON representation
A Javascript-powered image carousel/slider.
- Host: GitHub
- URL: https://github.com/gregolive/img-carousel
- Owner: gregolive
- Created: 2022-03-07T06:46:49.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-07T08:00:43.000Z (almost 3 years ago)
- Last Synced: 2024-04-26T17:13:43.019Z (8 months ago)
- Topics: css, javascript, npm, npm-module
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@gregolive/img-carousel
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Image Carousel
A Javascript-powered image carousel/slider. Users can slide the carousel using arrow buttons, select an image with the dot navigation below, or allow the carousel to advance automatically every 5 seconds.
[Live demo](https://gregolive.github.io/dynamic-ui-design/#img-carousel-demo) 👈
[npm package](https://www.npmjs.com/package/@gregolive/img-carousel) 📦
## Prerequisites
For icons to display, please install [font-awesome](https://www.npmjs.com/package/font-awesome).
## Installation
On the command line run:
```
npm i @gregolive/img-carousel
```Import the function in your Javascript file with:
```
import imgCarousel from '@gregolive/img-carousel';
```## Usage
Pass an array of images to the function.
We recommend using webpack's [image loader](https://webpack.js.org/guides/asset-management/#loading-images) if using webpack:
```
import img1 from './img1.jpg';
import img2 from './img1.jpg';const carousel = imgCarousel([img1, img2]);
```Append to the DOM.
```
document.body.appendChild(carousel);
```Default styling (colors, padding, etc.) can be overridden by overriding the CSS variables in:
```
:root {
...
}
```## License
ISC