Create a simple fully customizable countdown that support years, months, days, hours, minutes and seconds display
Table of content
- Get Started
- Active class
- Step classes
- Sugar Web Components Documentation
- Browsers support
- Code linting
- Who are Coffeekraken?
npm install coffeekraken-s-countdown-component --save
Then simply use it inside your html like so:
Each countdown elements like
[s-countdown-hours], etc... will contain his remaining digit. This digit will be wrapped inside a
span that will have these classes:
.s-countdown-digit-container: Applied on the parent element
.s-countdown-digit: The main class applied during the whole life of the digit.
.s-countdown-digit--out: The class applied on the digit that need to get out.
Note that the new digit will be added when the previous one has finished his
An active class will be applied on the element itself during the countdown and removed at the end. This is useful if you want to hide the countdown when it's finished.
.active: Applied on the component itself during the countdown
Step classes are an interesting concept. There are classes applied depending on the number of seconds remaining in the countdown. By default, these are the step classes registered:
stepClasses:week1: 3600 * 24 * 7day1: 3600 * 24hour1: 3600minutes30: 60 * 30minutes10: 60 * 10minutes5: 60 * 5minute1: 60
Thie mean that the these classes will be applied on the countdown:
.week1: Applied when the countdown is less than 1 week left
.day1: Applied when the countdown is less than 1 day left
.hour1: Applied when the countdown is less than 1 hour left
.minutes30: Applied when the countdown is less than 30 minutes left
.minutes10: Applied when the countdown is less than 10 minutes left
.minutes5: Applied when the countdown is less than 5 minutes left
.minute1: Applied when the countdown is less than 1 minute left
You can as well configure that by setting the
IE / Edge
|IE11+||last 2 versions||last 2 versions||last 2 versions|
As browsers are automatically updated, we will keep as reference the last two versions of each but this component can work on older ones as well.
The webcomponent API (custom elements, shadowDOM, etc...) is not supported in some older browsers like IE10, etc... In order to make them work, you will need to integrate the corresponding polyfill.
This package uses some code linting rules. Here's the list:
Your commits will not been accepted if the code style is not respected!
This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day. To do so, you have several possibilities:
Who are Coffeekraken
We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.
The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...