easy-image-carousel

1.0.3 • Public • Published

Image-Carousel

Install with npm:

npm install easy-image-carousel

How to use

  • Create a div with the flex property in HTML:
<div style="display:flex"></div>
<!--Style inline, through a CSS file or Javascript -->
<!-- The carousel will match the height and width set on this element -->
  • Inside your Javascript file:
// Supports ES6 Module Syntax
import createCarousel from "easy-image-carousel";
import exampleImage from "./path/to/image"; // imported image
import anotherExampleImage from "./path/to/image"; // imported image

// these are the images imported above.
const myImage = new Image();
const myOtherImage = new Image();
myImage.src = exampleImage;
myOtherImage.src = anotherExampleImage;

//Store images in array
const allCarouselImages = [myImage, myOtherImage];

// select div element with the flex property created in the above HTML.
const imageCarouselContainer = document.querySelector("div");

// Run function with the Images array and the div created above in the HTML.
createCarousel(allCarouselImages, imageCarouselContainer);

example

Package Sidebar

Install

npm i easy-image-carousel

Weekly Downloads

15

Version

1.0.3

License

ISC

Unpacked Size

6.55 kB

Total Files

3

Last publish

Collaborators

  • liamsuu