added click to select option...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-07-22 00:11:20 +03:00
parent b8a0146d63
commit f869066082

View File

@ -143,6 +143,7 @@ var keyboard = {
var Gallery = {
allow_row_expansion: true,
click_to_select: true,
code: `
<div class="gallery">
@ -405,8 +406,15 @@ var Gallery = {
.addEventListener('click', function(evt){
var target = evt.target
if(target.tagName == 'IMG'){
that.current = target
that.show() } })
// first click selects, second shows...
if(that.click_to_select){
target.classList.contains('current') ?
that.show()
: (that.current = target)
// first click selects and shows...
} else {
that.current = target
that.show() } } })
// handle resizing...
new ResizeObserver(