Wedding Invitation
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

app.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import './bootstrap';
  2. // resources/js/app.js
  3. import '@fortawesome/fontawesome-free/css/all.min.css';
  4. // Countdown date (adjust this date to your desired countdown target)
  5. const countdownDate = new Date('2024-08-17T11:00:00').getTime();
  6. // Update the countdown every second
  7. const countdownElement = document.getElementById('countdown');
  8. const countdownTimer = setInterval(() => {
  9. // Get the current date and time
  10. const now = new Date().getTime();
  11. // Calculate the time remaining
  12. const distance = countdownDate - now;
  13. // Calculate days, hours, minutes, and seconds
  14. const days = Math.floor(distance / (1000 * 60 * 60 * 24));
  15. const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  16. const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  17. const seconds = Math.floor((distance % (1000 * 60)) / 1000);
  18. // Format the countdown into a string
  19. const countdownHTML = `
  20. <div class="flex flex-col">
  21. <div class="flex gap-8 justify-center">
  22. <div class="font-medium text-gray-500">${days}</div>
  23. <div class="font-medium text-gray-500">:</div>
  24. <div class="font-medium text-gray-500">${hours.toString().padStart(2, '0')}</div>
  25. <div class="font-medium text-gray-500">:</div>
  26. <div class="font-medium text-gray-500">${minutes.toString().padStart(2, '0')}</div>
  27. <div class="font-medium text-gray-500">:</div>
  28. <div class="font-medium text-gray-500">${seconds.toString().padStart(2, '0')}</div>
  29. </div>
  30. <div class="flex gap-14 justify-center">
  31. <div class="font-medium text-gray-600">Hari</div>
  32. <div class="font-medium text-gray-600">Jam</div>
  33. <div class="font-medium text-gray-600">Minit</div>
  34. <div class="font-medium text-gray-600">Saat</div>
  35. </div>
  36. </div>
  37. `;
  38. // Display the countdown in the element
  39. countdownElement.innerHTML = countdownHTML;
  40. // If the countdown is over, clear the timer and display a message
  41. if (distance < 0) {
  42. clearInterval(countdownTimer);
  43. countdownElement.innerHTML = 'Majlis berlangsung';
  44. }
  45. }, 1000); // Update every second (1000 milliseconds)
  46. $(function() {
  47. var partLeftPos = 0;
  48. var partRightPos = 0;
  49. $(window).scroll(function(event) {
  50. var distance = $(this).scrollTop() * 2;
  51. var left = partLeftPos - distance;
  52. var right = partRightPos - distance;
  53. $('.left').css('left', left + "px");
  54. $('.right').css('right', right + "px");
  55. // Calculate boundaries
  56. var leftPartRightEdge = $('.left').offset().left + $('.left').outerWidth();
  57. // Check if both parts are completely off-screen
  58. var isLeftOffScreen = leftPartRightEdge <= 0;
  59. // Toggle visibility and z-index
  60. if (isLeftOffScreen && left < 0) {
  61. $('.parent').removeClass(['z-30']);
  62. } else {
  63. $('.parent').addClass(['z-30']);
  64. }
  65. });
  66. // Initially check visibility on page load
  67. $(window).trigger('scroll');
  68. document.addEventListener('DOMContentLoaded', function() {
  69. const observer = new IntersectionObserver(entries => {
  70. entries.forEach(entry => {
  71. if (entry.isIntersecting) {
  72. entry.target.classList.add('animate-fadeUp');
  73. entry.target.classList.remove('opacity-0');
  74. }
  75. });
  76. }, {
  77. threshold: 0.1
  78. });
  79. document.querySelectorAll('.fade-up').forEach(element => {
  80. observer.observe(element);
  81. });
  82. });
  83. });