Easy JavaScript/jQuery Countdown Clock Builder
by Nathan Rohler
You've seen them on many sites. If time is involved, there's usually a countdown clock somewhere.
After all, you only have 2 days, 4 hours, 12 minutes and 2 seconds to grab that unbelievable Groupon deal. And your sister-in-law's website is launching in 3 months and 4 days (somebody was playing with the website builder widgets).
Whether it's the end of a sale, an upcoming event, or just a clock showing the current time, there are numerous uses for adding a time clock or countdown clock to your site. In this article, I'll show you exactly how to add a flip clock or a text clock to your site. Thanks to the builder tool, it will only take seconds.
As the starting point for creating these clocks, we're going to use two different helper libraries (FlipClock.js and jQuery.countdown). We could write it all by hand, but other kind folks have already done most of the heavy lifting for us!
Step 1 – Choose Your Options:
Simply choose the options for what kind of clock you want to create. The live preview is displayed below:
1. What time do you want to display?
2. Display style:
3. Display format:
4. (Optional) Customize Colors and Language Show
Step 2 – Add The Following Customized Code to Your Page:
First, download this .zip
file, unzip it, and place the resulting clock_assets/
folder inside the folder that holds your HTML page. (If you're using WordPress, upload the folder to any convenient location on your site and determine the URL to the folder. In the code below, you'll need to update the references to the clock_assets/
folder to point to the full URL.)
Now, add this code inside the <head>
of your page, just before the closing </head>
tag:
Note: If you're using WordPress, you can add this code to the head.php template file.
Add this code inside the <body>
of your page, wherever you want the clock to appear:
Note: If you're using WordPress, you can add this code to the HTML for a post or page.
Step 3 – Enjoy and Share Your Feedback!
It's as simple as that. No more fumbling around with complex scripts; just copy and paste. If the clock doesn't seem to be working, double-check that the clock_assets/
folder has been uploaded to your site, and check the Chrome developer console (View > Developer > JavaScript Console) for any other errors.
We hope you find this builder useful. Have feedback or suggestions? Please share in the comments below!