Separate handling for closing for mobile and desktop

Clicking on the image only closes on desktop now, while on mobile the close button has to be pressed as touch is used for the magnification
This commit is contained in:
Kristan Schlikow 2024-04-14 22:17:38 +02:00
parent 31077629f1
commit 54eec3e215
No known key found for this signature in database
GPG Key ID: B92ED0CBF4AD31EA
2 changed files with 10 additions and 2 deletions

View File

@ -5950,7 +5950,7 @@
<div class="zoomed_avatar_container">
<div class="panelControlBar flex-container">
<div class="fa-fw fa-solid fa-grip drag-grabber"></div>
<div class="fa-fw fa-solid fa-circle-xmark dragClose"></div>
<div class="fa-fw fa-solid fa-circle-xmark dragClose" id="closeZoom"></div>
</div>
<img class="zoomed_avatar_img" src=""
data-izoomify-url=""

View File

@ -10245,7 +10245,7 @@ jQuery(async function () {
$(`.zoomed_avatar[forChar="${charname}"] .dragClose`).hide();
}
$('.zoomed_avatar, .zoomed_avatar .dragClose').on('click touchend', (e) => {
$('.zoomed_avatar').on('mouseup', (e) => {
if (e.target.closest('.drag-grabber')) {
return;
}
@ -10254,6 +10254,14 @@ jQuery(async function () {
});
});
$('.zoomed_avatar, .zoomed_avatar .dragClose').on('click touchend', (e) => {
if (e.target.closest('.dragClose')) {
$(`.zoomed_avatar[forChar="${charname}"]`).fadeOut(animation_duration, () => {
$(`.zoomed_avatar[forChar="${charname}"]`).remove();
});
}
});
zoomedAvatarImgElement.on('dragstart', (e) => {
console.log('saw drag on avatar!');
e.preventDefault();