mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
Update thumbnails.js
This commit is contained in:
1 parent
00f780a7dc
commit
8f8b69cc25
1 file changed
+4
-1
@@ -14,6 +14,7 @@ export default function thumbnails(options) {
|
|||||||
let image = null;
|
let image = null;
|
||||||
let loading = false;
|
let loading = false;
|
||||||
let isLoad = false;
|
let isLoad = false;
|
||||||
|
let isHover = false;
|
||||||
|
|
||||||
function showThumbnails(event) {
|
function showThumbnails(event) {
|
||||||
const { width: posWidth } = getPosFromEvent(art, event);
|
const { width: posWidth } = getPosFromEvent(art, event);
|
||||||
@@ -38,6 +39,7 @@ export default function thumbnails(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proxy($progress, 'mousemove', async (event) => {
|
proxy($progress, 'mousemove', async (event) => {
|
||||||
|
isHover = true;
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
loading = true;
|
loading = true;
|
||||||
const img = await loadImg(option.thumbnails.url);
|
const img = await loadImg(option.thumbnails.url);
|
||||||
@@ -45,13 +47,14 @@ export default function thumbnails(options) {
|
|||||||
isLoad = true;
|
isLoad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoad) {
|
if (isLoad && isHover) {
|
||||||
setStyle($control, 'display', 'flex');
|
setStyle($control, 'display', 'flex');
|
||||||
showThumbnails(event);
|
showThumbnails(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
proxy($progress, 'mouseleave', () => {
|
proxy($progress, 'mouseleave', () => {
|
||||||
|
isHover = false;
|
||||||
setStyle($control, 'display', 'none');
|
setStyle($control, 'display', 'none');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user