Skip to content

Commit

Permalink
fix hover on phones
Browse files Browse the repository at this point in the history
  • Loading branch information
MoayedHajiAli committed Jun 23, 2024
1 parent 55c2711 commit 8c68695
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -571,24 +571,26 @@ <h2 class="title">Improvements</h2>
});
}

// 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');
const caption = item.querySelector('.video-caption');
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');
Expand Down
8 changes: 8 additions & 0 deletions docs/resources/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8c68695

Please sign in to comment.