diff options
Diffstat (limited to 'template/script.js')
| -rwxr-xr-x | template/script.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/template/script.js b/template/script.js index 8b13789..3d80484 100755 --- a/template/script.js +++ b/template/script.js | |||
| @@ -1 +1,17 @@ | |||
| 1 | // dither image on mouse over replace | ||
| 2 | document.querySelectorAll('article img').forEach(img => { | ||
| 1 | 3 | ||
| 4 | const ditheredImage = img.src; | ||
| 5 | const originalImage = img.src.replace('.dith.gif', ''); | ||
| 6 | |||
| 7 | img.addEventListener('mouseover', evt => { | ||
| 8 | evt.target.src = originalImage; | ||
| 9 | console.log('mouseover') | ||
| 10 | }); | ||
| 11 | |||
| 12 | img.addEventListener('mouseout', evt => { | ||
| 13 | evt.target.src = ditheredImage; | ||
| 14 | console.log('mouseout') | ||
| 15 | }); | ||
| 16 | |||
| 17 | }); | ||
