33 lines
918 B
JavaScript
33 lines
918 B
JavaScript
document.querySelectorAll(".video-container").forEach(container => {
|
|
let video = container.querySelector("video");
|
|
let playBtn = container.querySelector(".play-button");
|
|
|
|
function playVideo() {
|
|
video.play().catch(error => console.log("Autoplay prevented:", error));
|
|
playBtn.style.opacity = "0"; // Hide play button
|
|
}
|
|
|
|
function pauseVideo() {
|
|
setTimeout(() => {
|
|
if (!video.matches(":hover")) {
|
|
video.pause();
|
|
playBtn.style.opacity = "1"; // Show play button again
|
|
}
|
|
}, 30);
|
|
}
|
|
|
|
container.addEventListener("mouseover", playVideo);
|
|
container.addEventListener("mouseout", pauseVideo);
|
|
});
|
|
|
|
setTimeout(() => {
|
|
document.querySelector(".line").classList.add("animate");
|
|
}, 1000); // 1000ms = 1 second delay
|
|
setTimeout(() => {
|
|
document.querySelector(".uni-img").classList.add("animate");
|
|
}, 1500); // 1000ms = 1 second delay
|
|
|
|
|
|
|
|
|
|
|