summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordan <[email protected]>2023-06-19 16:12:13 -0400
committerdan <[email protected]>2023-06-19 16:12:13 -0400
commitd95a6479d824d507cadb0e7a09d814d21b09f319 (patch)
tree5e545986b4da5c82d3a0ff3f1dc6f030092f8830
parent79d313362894fe9a978bac53b2d86fafa86a2b09 (diff)
downloadphoto-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.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/demo.js b/demo.js
index 9b843cc..7050c7c 100644
--- a/demo.js
+++ b/demo.js
@@ -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';