diff --git a/data/newtabicons-content.js b/data/newtabicons-content.js index b24dee7..b055ca9 100644 --- a/data/newtabicons-content.js +++ b/data/newtabicons-content.js @@ -9,11 +9,13 @@ 'use strict'; function mouseOverListener(e) { - e.target.style.backgroundImage = e.target.dataset.newPreview; + let thumb = e.target.previousElementSibling; + thumb.style.backgroundImage = thumb.dataset.newPreview; } function mouseOutListener(e) { - e.target.style.backgroundImage = e.target.dataset.oldPreview; + let thumb = e.target.previousElementSibling; + thumb.style.backgroundImage = thumb.dataset.oldPreview; } function mouseMoveListener (e) { @@ -82,6 +84,7 @@ function updateThumbnails() { thumb.style.backgroundImage = thumb.dataset.newPreview; thumb.removeEventListener('mouseover', mouseOverListener); thumb.removeEventListener('mouseout', mouseOutListener); + window.addEventListener('mousemove', mouseMoveListener); break; case 3: thumb.style.backgroundImage = thumb.dataset.oldPreview; @@ -90,8 +93,6 @@ function updateThumbnails() { } } } - - window.addEventListener('mousemove', mouseMoveListener); } function addThumbnails(thumbnails) {