Popup for touch devices
This commit is contained in:
@@ -194,6 +194,12 @@ function downloadFile(blob, filename) {
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
function isTouchDevice() {
|
||||
return (('ontouchstart' in window) ||
|
||||
(navigator.maxTouchPoints > 0) ||
|
||||
(navigator.msMaxTouchPoints > 0));
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
$('button.close').on('click', e => {
|
||||
close_modal();
|
||||
@@ -342,4 +348,17 @@ onLoad(() => {
|
||||
let dialog = e.target.closest('.popup');
|
||||
if (!dialog) close_modal();
|
||||
});
|
||||
|
||||
if (isTouchDevice()) {
|
||||
$("[title]").on('click', e => {
|
||||
let item = e.target.closest('[title]');
|
||||
let title = item.getAttribute('title');
|
||||
let popup = item.find('.title-popup')
|
||||
if (popup.length === 0) {
|
||||
item.insertAdjacentHTML('beforeend', `<span class="title-popup">${title}</span>`);
|
||||
} else {
|
||||
item.removeChild(popup[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user