mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix hover menus
This commit is contained in:
parent
f81c84719f
commit
0a7b7a14e3
1 changed files with 15 additions and 8 deletions
|
@ -205,6 +205,8 @@
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
|
var preventHover = false;
|
||||||
|
|
||||||
function onShowTimerExpired(elem) {
|
function onShowTimerExpired(elem) {
|
||||||
|
|
||||||
if ($(elem).hasClass('hasContextMenu')) {
|
if ($(elem).hasClass('hasContextMenu')) {
|
||||||
|
@ -240,6 +242,11 @@
|
||||||
|
|
||||||
function onHoverIn() {
|
function onHoverIn() {
|
||||||
|
|
||||||
|
if (preventHover === true) {
|
||||||
|
preventHover = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (showOverlayTimeout) {
|
if (showOverlayTimeout) {
|
||||||
clearTimeout(showOverlayTimeout);
|
clearTimeout(showOverlayTimeout);
|
||||||
showOverlayTimeout = null;
|
showOverlayTimeout = null;
|
||||||
|
@ -254,16 +261,16 @@
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/
|
function preventTouchHover() {
|
||||||
|
preventHover = true;
|
||||||
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) {
|
|
||||||
/* browser with either Touch Events of Pointer Events
|
|
||||||
running on touch-capable device */
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.off('.posterItemHoverMenu').on('mouseenter.posterItemHoverMenu', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverIn)
|
var elems = '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem';
|
||||||
.on('mouseleave.posterItemHoverMenu', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverOut);
|
|
||||||
|
return this.off('.posterItemHoverMenu')
|
||||||
|
.on('mouseenter.posterItemHoverMenu', elems, onHoverIn)
|
||||||
|
.on('mouseleave.posterItemHoverMenu', elems, onHoverOut)
|
||||||
|
.on("touchstart.posterItemHoverMenu", elems, preventTouchHover);
|
||||||
};
|
};
|
||||||
|
|
||||||
function toggleSelections(page) {
|
function toggleSelections(page) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue