Skip to content

Repository files navigation

Carousel banner

Carousel

An example of a flexible carousel library for you to take and use as you wish in your projects. It's simple to use the lbirary to wrap your own UI elements in standard carousel functionality. See the demo page for some simple examples.

Demo

Features

  • Vanilla Typescript
  • Light & Responsive
  • Touch events
  • Use in your projects or as learning material

Options

Setup

Pass options to configure your carousel for different breakpoints

Options

DescriptionType
elThe pixel >= this should apply toHTMLElement
gridSee Grid type belowGrid[]
showPager?Optional flag to hide the carousel pagerBoolean

Grid

DescriptionType
widthIf the viewport width is higher than this number the below items total will be usednumber
itemsThe number of carousel slides to show at one timenumber

Usage

e.g.

importCarouselfrom"./carousel"constcarousels=document.querySelectorAll<HTMLElement>(`.carousel`);tiles.forEach(el=>{constoptions: Options={
el,grid: [{width: 0,// from 0px - 699px there will only be 1 slide visibleitems: 1},{width: 700,// from 700px - 899px there will only be 2 slides visibleitems: 2},{width: 900,// from > 900px there will 8 slides visibleitems: 8}]};constc=newCarousel(options)c.setup();})

About

A simple but essential carousel library

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages