After downloading the browser.js file and style.css,
you can follow the tutorial bellow to use flexcards.js.
For more informations about the functions used, go to the usage section.
If you downloaded the files, you can include them in your HTML file like this:
<script src="path/to/browser.js"></script>
<link rel="stylesheet" href="path/to/style.css">
Install the package using the following NPM command:
npm install flexcardsjs --save
Then, you can import the package in your project:
import FlexCards from 'flexcardsjs';
import 'flexcardsjs/build/style.css';
Unavailable for now (deprecated version remains available).
First of all, ensure that you have included the right files in your project.
-
In your HTML file, you can include the following code:
<!-- Your component --> <div id="flexcards"> <!-- Articles are the items to display here --> <article>Lorem ipsum</article> <article>Dolor sit</article> <article>Amet consectetur</article> </div>
-
In your JavaScript file or
<script>
tag, you can simply create a new instance of flexcards.js like this:const carousel = new FlexCards.Carousel('#flexcards', { // Options // ... });
Check the options section for more informations about the available options.\
Option can be passed as a second argument in each flexcards.js
instance. Here are the available
options for each instance:
-
components
:default
will loadarticle
(<article>
) elements andimages
will load<img>
elements. -
theme
: an hexadecimal color to apply as the theme of the flexcards instance.
A simple and customizable JavaScript and CSS carousel designed for smooth transitions and flexible configuration.
-
delay
: Delay in milliseconds before the next slide (default: 6s). -
autoplay
: Automatically cycle through slides (default: true). -
loop
: Loop back to the first slide at the end (by default: true). -
displayIndex
(none
,dots
,numbers
) : Type of index to display at the bottom (default: "none
"). -
arrows
: Show control arrows on each side of the carousel (shown by default). -
arrowSrc
: Custom image source for arrows (default arrow provided). -
progressBar
: Display a progress bar at the top (default: false).
-
next(n)
: Go to the next slide. Ifn
is provided, go to then
th next slide. -
prev(n)
: Go to the previous slide. Ifn
is provided, go to then
th previous slide. -
pause()
: Pause the carousel. -
play()
: Play the carousel.
This project is under the MIT License.
Please, consider reading the LICENSE file for more informations.
I just customize the code found this StackOverflow subject. So all credits goes to the posts on this subject and especially to MultiplyByZer0.