extra.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Wrap every letter in a span
  2. var textWrapper = document.querySelector('.ml3');
  3. textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>");
  4. anime.timeline({loop: true})
  5. .add({
  6. targets: '.ml3 .letter',
  7. opacity: [0,1],
  8. easing: "easeInOutQuad",
  9. duration: 2250,
  10. delay: (el, i) => 150 * (i+1)
  11. }).add({
  12. targets: '.ml3',
  13. opacity: 0,
  14. duration: 1000,
  15. easing: "easeOutExpo",
  16. delay: 1000
  17. });
  18. //全屏视频
  19. var video = document.getElementById("video1");
  20. var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
  21. if (isMobile) {
  22. video.style.display = "none";
  23. video.muted = true;
  24. } else {
  25. video.volume = 0.5; // 或者根据需要设置适当的音量值,例如 0.5 表示 50% 的音量
  26. }
  27. // 优化
  28. // const container = document.querySelector('.container');
  29. // const boxes = document.querySelectorAll('p');
  30. // // Read a layout property
  31. // const newWidth = container.offsetWidth;
  32. // for (var i = 0; i < boxes.length; i++) {
  33. // // Then invalidate layouts with writes.
  34. // boxes[i].style.width = newWidth + 'px';
  35. // }
  36. // const width = box.offsetWidth;
  37. // box.classList.add('big');
  38. // // When the user clicks on a link/button:
  39. // async function navigateToSettingsPage() {
  40. // // Capture and visually freeze the current state.
  41. // await document.documentTransition.prepare({
  42. // rootTransition: 'cover-up',
  43. // sharedElements: [element1, element2, element3],
  44. // });
  45. // // This is a function within the web app:
  46. // updateDOMForSettingsPage();
  47. // // Start the transition.
  48. // await document.documentTransition.start({
  49. // sharedElements: [element1, element4, element5],
  50. // });
  51. // // Transition complete!
  52. // }
  53. // 优化end