Advertisement
Guest User

Untitled

a guest
Oct 30th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1.  
  2.  
  3.  
  4. <style>
  5. p {
  6. text-align: center;
  7. font-size: 60px;
  8. }
  9.  
  10. #picture img {
  11. display: block;
  12. margin: auto;
  13. width: 75%;
  14. }
  15.  
  16. </style>
  17.  
  18. <div id="picture">
  19. <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Twemoji_1f384.svg/2000px-Twemoji_1f384.svg.png" alt="">
  20. </div>
  21. <p id="demo"></p>
  22.  
  23. <script>
  24. // Set the date we're counting down to
  25. var countDownDate = new Date("Dec 24, 2017 00:00:00").getTime();
  26.  
  27. // Update the count down every 1 second
  28. var x = setInterval(function() {
  29.  
  30. // Get todays date and time
  31. var now = new Date().getTime();
  32.  
  33. // Find the distance between now an the count down date
  34. var distance = countDownDate - now;
  35.  
  36. // Time calculations for days, hours, minutes and seconds
  37. var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  38. //var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  39. //var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  40. //var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  41.  
  42. // Output the result in an element with id="demo"
  43. document.getElementById("demo").innerHTML = days + " dagar kvar till jul! " ;
  44. //+ hours + "h "+ minutes + "m " + seconds + "s "
  45. // If the count down is over, write some text
  46. if (distance < 0) {
  47. clearInterval(x);
  48. document.getElementById("demo").innerHTML = "Nu รคr det jul!";
  49. }
  50. }, 1000);
  51. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement