Block event propagation when lightbox is triggered
This commit is contained in:
parent
56ff118845
commit
f96d8a601c
16
script.js
16
script.js
@ -80,11 +80,14 @@ function closeModal() {
|
|||||||
gradioApp().getElementById("lightboxModal").style.display = "none";
|
gradioApp().getElementById("lightboxModal").style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
function showModal(elem) {
|
function showModal(event) {
|
||||||
gradioApp().getElementById("modalImage").src = elem.src
|
var source = event.target || event.srcElement;
|
||||||
|
gradioApp().getElementById("modalImage").src = source.src
|
||||||
gradioApp().getElementById("lightboxModal").style.display = "block";
|
gradioApp().getElementById("lightboxModal").style.display = "block";
|
||||||
|
event.stopPropagation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function showGalleryImage(){
|
function showGalleryImage(){
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
fullImg_preview = gradioApp().querySelectorAll('img.w-full.object-contain')
|
fullImg_preview = gradioApp().querySelectorAll('img.w-full.object-contain')
|
||||||
@ -92,12 +95,13 @@ function showGalleryImage(){
|
|||||||
if(fullImg_preview != null){
|
if(fullImg_preview != null){
|
||||||
fullImg_preview.forEach(function function_name(e) {
|
fullImg_preview.forEach(function function_name(e) {
|
||||||
if(e && e.parentElement.tagName == 'DIV'){
|
if(e && e.parentElement.tagName == 'DIV'){
|
||||||
|
|
||||||
e.style.cursor='pointer'
|
e.style.cursor='pointer'
|
||||||
|
|
||||||
elemfunc = function(elem){
|
e.addEventListener('click', function (evt) {
|
||||||
elem.onclick = function(){showModal(elem)};
|
showModal(evt)
|
||||||
}
|
|
||||||
elemfunc(e)
|
},true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user