paytonshaltis / freighter

🚂 Freighter is a highly-customizable HTML carousel library featuring a number of dynamic properties affecting carousel items and transitions. Most prominently, it gives complete control over the resizing method (for responsive layouts) as well as the wrapping method (for content display).
https://paytonshaltis.github.io/freighter
MIT License
1 stars 0 forks source link

Refactor with classes. #6

Closed paytonshaltis closed 1 year ago

paytonshaltis commented 1 year ago

Closes #2, closes #5.

The index.ts file has been moved into the Carousel.ts file. This file contains the class definition for a Carousel object, which can now be created in a much simpler fashion.

The interface for creating a carousel requires a single container (with any ID the user requests) and any number of div children with some content in them. The class constructor does the rest in order to apply the user's requested settings and add the carousel into the DOM at the position of the original parent div.