qsadfasdgfgads

Untitled

Jul 21st, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   $(document).ready(function() {
  2.    $(".media-block .timer p span").each(function( index, el) {
  3.         if($( el ).text() != '0:00:00:00'){
  4.             var text = $( el ).text();
  5.             var result = text.split(',').map(function (x) {
  6.                 return parseInt(x, 10);
  7.             });
  8.             console.log(result);
  9.             var countDownDate = new Date(result[0], result[1], result[2], result[3], result[4], result[5]);
  10.          
  11.             console.log(countDownDate);
  12.             // Update the count down every 1 second
  13.             var x = setInterval(function() {
  14.  
  15.               // Get today's date and time
  16.               var now = new Date().getTime();
  17.  
  18.               // Find the distance between now and the count down date
  19.               var distance = countDownDate - now;
  20.               // Time calculations for days, hours, minutes and seconds
  21.               var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  22.               var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  23.               var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  24.               var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  25.  
  26.               // Display the result in the element with id="demo"
  27.              $( el ).html(days + "d " + hours + "h " + minutes + "m " + seconds + "s ");
  28.  
  29.               // If the count down is finished, write some text
  30.               if (distance < 0) {
  31.                 clearInterval(x);
  32.                 $(el).html() = "EXPIRED";
  33.               }
  34.             }, 1000);
  35.         }
  36.     });
  37.     });
  38.     $(document).ready(function() {
  39.         $('.timetable-accordeon .acc-head').on('click', f_acc);
  40.  
  41.     });
  42.  
  43.     function f_acc() {
  44.         $('.timetable-accordeon .acc-body').not($(this).next()).slideUp(500);
  45.         $(this).next().slideToggle(500);
  46.     }
Advertisement
Add Comment
Please, Sign In to add comment