File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,13 +56,20 @@ function initPanelZoom() {
5656 document.body.appendChild(overlay);
5757
5858 document.querySelectorAll('.panel img').forEach((img) => {
59- img.addEventListener('mouseenter', () => {
59+ // Restart the dwell countdown on every movement so the overlay only opens
60+ // after the cursor has been still for 800ms over the plot image, not merely
61+ // present within its bounds.
62+ const scheduleZoom = () => {
63+ if (overlay.classList.contains('open')) return; // already shown; leave it
6064 if (img.src.includes('placeholder')) return;
65+ clearTimeout(zoomTimer);
6166 zoomTimer = setTimeout(() => {
6267 big.src = img.src;
6368 overlay.classList.add('open');
6469 }, 800);
65- });
70+ };
71+ img.addEventListener('mouseenter', scheduleZoom);
72+ img.addEventListener('mousemove', scheduleZoom);
6673 img.addEventListener('mouseleave', () => {
6774 clearTimeout(zoomTimer);
6875 overlay.classList.remove('open');
You can’t perform that action at this time.
0 commit comments