diff options
author | dan <[email protected]> | 2023-06-19 16:12:13 -0400 |
---|---|---|
committer | dan <[email protected]> | 2023-06-19 16:12:13 -0400 |
commit | d95a6479d824d507cadb0e7a09d814d21b09f319 (patch) | |
tree | 5e545986b4da5c82d3a0ff3f1dc6f030092f8830 | |
parent | 79d313362894fe9a978bac53b2d86fafa86a2b09 (diff) | |
download | photo-album-gen-d95a6479d824d507cadb0e7a09d814d21b09f319.tar.gz photo-album-gen-d95a6479d824d507cadb0e7a09d814d21b09f319.tar.bz2 photo-album-gen-d95a6479d824d507cadb0e7a09d814d21b09f319.zip |
fix: clicking save image does not focus image
-rw-r--r-- | demo.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -43,7 +43,8 @@ function download() { // URL.revokeObjectURL(link.href); } -function downloadImage(index) { +function downloadImage(event, index) { + event.stopPropagation(); // so that clicking does not trigger focusImage as well const imageNodes = document.getElementsByClassName('image-preview'); const image = imageNodes[index]; const link = document.createElement('a'); @@ -119,7 +120,7 @@ function renderImages() { const downloadButton = document.createElement('button'); downloadButton.innerText = 'Save Image'; - downloadButton.setAttribute('onclick', `downloadImage(${i})`); + downloadButton.setAttribute('onclick', `downloadImage(event,${i})`); x.className = 'image-preview'; |