Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Countdown Timer BS4"
Bootstrap 4.1.1 Snippet by
aswanik11
4.1.1
Preview
HTML
CSS
JS
View Full Screen
Forked from
Fork
Fork this
Parent
542
 
0 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="col-lg-6 offset-3"> <h2>Sale up to 45%!</h2> <div class="timer"> <div> <span class="days" id="day"></span> <div class="smalltext">Days</div> </div> <div> <span class="hours" id="hour"></span> <div class="smalltext">Hours</div> </div> <div> <span class="minutes" id="minute"></span> <div class="smalltext">Minutes</div> </div> <div> <span class="seconds" id="second"></span> <div class="smalltext">Seconds</div> </div> <p id="time-up"></p> </div> </div> </div> </div>
h2 { font-family: Poppins; font-weight: 500; margin: 0 0 20px; } .timer { margin: 0 0 45px; font-family: sans-serif; color: #fff; display: inline-block; font-weight: 100; text-align: center; font-size: 30px; } .timer div { padding: 10px; border-radius: 3px; background: #000000; display: inline-block; font-family: Oswald; font-size: 26px; font-weight: 400; width: 80px; } .timer .smalltext { color: #888888; font-size: 12px; font-family: Poppins; font-weight: 500; display: block; padding: 0; width: auto; } .timer #time-up { margin: 8px 0 0; text-align: left; font-size: 14px; font-style: normal; color: #000000; font-weight: 500; letter-spacing: 1px; }
var deadline = new Date("july 30, 2050 12:00:00").getTime(); var x = setInterval(function() { var currentTime = new Date().getTime(); var t = deadline - currentTime; var days = Math.floor(t / (1000 * 60 * 60 * 24)); var hours = Math.floor((t%(1000 * 60 * 60 * 24))/(1000 * 60 * 60)); var minutes = Math.floor((t % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((t % (1000 * 60)) / 1000); document.getElementById("day").innerHTML =days ; document.getElementById("hour").innerHTML =hours; document.getElementById("minute").innerHTML = minutes; document.getElementById("second").innerHTML =seconds; if (t < 0) { clearInterval(x); document.getElementById("time-up").innerHTML = "TIME UP"; document.getElementById("day").innerHTML ='0'; document.getElementById("hour").innerHTML ='0'; document.getElementById("minute").innerHTML ='0' ; document.getElementById("second").innerHTML = '0'; } }, 1000);
Related:
See More
Free Template
Gaia Bootstrap Template
173.8K
165
Carousel with Timer and Caption
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76