A small lib to create a nice flipping card effect, that works mobile by paning, and on desktop by hover.
Demo:
https://illnr.github.io/Flip-Card-JS/demo/main/
https://illnr.github.io/Flip-Card-JS/demo/js-module/
Written in ES6 modules :)
No Dependency, maybe conflict with jQuery, not tested yet.
Import your JS File in your HTML via:
<script type="module" src="script.js"></script>
In your JS File:
import FlipCard from 'flipcard-es6m.js';
document.addEventListener("DOMContentLoaded", function(event) {
let fc = new FlipCard({addCssPositioning: true});
});
Import your JS Files in your HTML via:
<script src="flipcard.js"></script>
<script src="script.js"></script>
In your JS File:
document.addEventListener("DOMContentLoaded", function(event) {
let fc = new FlipCard({addCssPositioning: true});
});
let fc = new FlipCard({addCssPositioning: true});
Hide the back of a card with opacity: 0.
ToDo: Add opacity enabler in API
A card consists of a (one) front and a (one) back, both within a container.
First you need to create an instance of FlipCard
.
const options = {};
let fc = new FlipCard(options);
Default options are:
const options = {
container: ".flip-card",
front: ".flip-card-front",
back: ".flip-card-back",
addCssBasic: true,
addCssPositioning: false,
addTouchSupport: true,
addMouseSupport: true
}