Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // top bar coung down timer
- (function () {
- const lastDate = document.getElementById('offer_limit').getAttribute('data-limit');
- // Set the date we're counting down to Y M D
- let countDownDate = new Date(lastDate).getTime();
- // Update the count down every 1 second
- let counter = setInterval(function () {
- // Get today's date and time
- let now = new Date().getTime();
- // Find the distance between now and the count down date
- let distance = countDownDate - now;
- // Formate single digit to double digit
- // const FormatMe = (n) => (n < 10) ? '0' + n : n;
- // Time calculations for days, hours, minutes and seconds
- let days = Math.floor(distance / (1000 * 60 * 60 * 24));
- let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
- let seconds = Math.floor((distance % (1000 * 60)) / 1000);
- // Output the result in an element with id="offer_limit"
- document.getElementById("offer_limit").innerHTML = `
- <ul>
- <li>${days} <span>Days</span></li>
- <li>${hours} <span>Hours</span></li>
- <li>${minutes} <span>Minutes</span></li>
- <li>${seconds} <span>Seconds</span></li>
- </ul>
- `;
- // If the count down is over, write some text
- if (distance < 0) {
- clearInterval(counter);
- // document.getElementById("offer_limit").innerHTML = "EXPIRED";
- document.querySelector('.top_bar').style.display = "none";
- }
- }, 1000);
- $(window).on('load resize orientationchange', function () {
- var navbar_height = $('.navbar').height();
- console.log(navbar_height);
- $('.header.header-banner').css('padding-top', 0 + navbar_height);
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement