aboutsummaryrefslogtreecommitdiffstats
path: root/script.js
diff options
context:
space:
mode:
authorDepFA <35278260+dfaker@users.noreply.github.com>2022-09-17 14:29:06 +0000
committerGitHub <noreply@github.com>2022-09-17 14:29:06 +0000
commitf96d8a601c782885d33ce021ad2c3f20b801dd24 (patch)
tree452de9eba764a88ed0c902f0954cee7a21aed8e9 /script.js
parent56ff118845748d1302968039e13703b6ad8107c4 (diff)
downloadstable-diffusion-webui-gfx803-f96d8a601c782885d33ce021ad2c3f20b801dd24.tar.gz
stable-diffusion-webui-gfx803-f96d8a601c782885d33ce021ad2c3f20b801dd24.tar.bz2
stable-diffusion-webui-gfx803-f96d8a601c782885d33ce021ad2c3f20b801dd24.zip
Block event propagation when lightbox is triggered
Diffstat (limited to 'script.js')
-rw-r--r--script.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/script.js b/script.js
index a016eb4e..9e3d42b5 100644
--- a/script.js
+++ b/script.js
@@ -80,11 +80,14 @@ function closeModal() {
gradioApp().getElementById("lightboxModal").style.display = "none";
}
-function showModal(elem) {
- gradioApp().getElementById("modalImage").src = elem.src
+function showModal(event) {
+ var source = event.target || event.srcElement;
+ gradioApp().getElementById("modalImage").src = source.src
gradioApp().getElementById("lightboxModal").style.display = "block";
+ event.stopPropagation()
}
+
function showGalleryImage(){
setTimeout(function() {
fullImg_preview = gradioApp().querySelectorAll('img.w-full.object-contain')
@@ -92,12 +95,13 @@ function showGalleryImage(){
if(fullImg_preview != null){
fullImg_preview.forEach(function function_name(e) {
if(e && e.parentElement.tagName == 'DIV'){
+
e.style.cursor='pointer'
- elemfunc = function(elem){
- elem.onclick = function(){showModal(elem)};
- }
- elemfunc(e)
+ e.addEventListener('click', function (evt) {
+ showModal(evt)
+
+ },true);
}
});
}