1.1.8 • Published 1 year ago

lulit-carousel v1.1.8

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

LULIT-CAROUSEL

A carousel built with lit-element and typescript.

Install

npm i lulit-carousel

Usage

Super easy, just put lulit-carousel tag wherever you want in your html, and fill it with data, by default it accepts img tag and apply some default styles and then import LuLitCarousel from 'lulit-carousel'

HTML

<html>
  <head>
  </head>
  <body>
    <lulit-carousel>
      <img src="img1">
      <img src="img2">
      <img src="img3">
      <img src="img4">
      ...
    </lulit-carousel>
  </body>
</html>

JS

ìmport LuLitCarousel from 'lulit-carousel'

Example

In the src folder of this repo you can find this example, and you can test that example here

Configuration

lulit-carousel accepts 4 attributes: ride, dir, time and duration and a custom event which return the current position

AttributeFunctionality
ridedefault: false, if true then active dir and time functionality
dirdefault: "right", if ride is true then dir defines the direction, possible values: "right" | "left"
timedefault: "5000", defines the time between transitions in miliseconds
durationdefault: "0.5", defines the duration of the transition in seconds
EventFunctionality
lutransitionendTriggered after move to another element in the carousel
PropertyFunctionality
selectedStore the current position

JS Example

element.addEventListener('lutransitionend', (e) => consolo.log(e.detail.selected));

TS Example

element.addEventListener('lutransitionend', (e: CustomInitEvent) => consolo.log(e.detail.selected));

or

element.addEventListener('lutransitionend', (e: CustomEvent<number>) => consolo.log(e.detail.selected));

Notes

  1. Transition animation does not use animate directive because it's still an experimental feature
  2. Transition animation does not use GSAP, since when I test it in a cheap mobile phone, it worked quite badly, indeed, my animation works better in the same mobile phone.

Maintainer

Cajal Fernando Lautaro
1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago