From 8c6869587f9f812427e10cf5a8ed79f0f8a192ec Mon Sep 17 00:00:00 2001 From: MoayedHajiAli Date: Sat, 22 Jun 2024 22:40:50 -0700 Subject: [PATCH] fix hover on phones --- docs/index.html | 8 +++++--- docs/resources/index.css | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/index.html b/docs/index.html index 73d053a..3f01de9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -571,7 +571,7 @@

Improvements

}); } - // Apply only if not on mobile + // Apply hover functionality only if not on mobile if (!isMobileDevice()) { videoItems.forEach(function(item) { const video = item.querySelector('.video-player'); @@ -579,16 +579,18 @@

Improvements

handleVideoHover(item, video, caption); }); } else { - // For mobile, ensure videos are muted and do not autoplay + // For mobile, ensure videos are muted and paused videoItems.forEach(function(item) { const video = item.querySelector('.video-player'); if (video) { video.muted = true; video.pause(); // Ensure video is paused + video.setAttribute('controls', false); // Disable controls to prevent user interaction + video.removeAttribute('autoplay'); // Ensure autoplay is disabled } }); } - }); + }); document.getElementById('menu-button').addEventListener('click', function() { const navLinks = document.getElementById('nav-links'); diff --git a/docs/resources/index.css b/docs/resources/index.css index 3e02617..5aa7d98 100644 --- a/docs/resources/index.css +++ b/docs/resources/index.css @@ -621,6 +621,14 @@ body { } +@media (hover: none) and (pointer: coarse) { + .video-item:hover { + /* Disable any hover effects for mobile devices */ + pointer-events: none; + } +} + + /* @media (min-width: 480px) {