qsadfasdgfgads

Untitled

Jul 21st, 2019
189
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.             var countDownDate = new Date(...result);
  9.          
  10.  
  11.             // Update the count down every 1 second
  12.             var x = setInterval(function() {
  13.  
  14.               // Get today's date and time
  15.               var now = new Date().getTime();
  16.  
  17.               // Find the distance between now and the count down date
  18.               var distance = countDownDate - now;
  19.  
  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