Commit f96d8a60 authored by DepFA's avatar DepFA Committed by GitHub

Block event propagation when lightbox is triggered

parent 56ff1188
......@@ -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);
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment