feat: Mostrar botón flotante en dispositivos táctiles o en vistas pequeñas para seleccionar servidor
This commit is contained in:
@@ -172,7 +172,10 @@
|
|||||||
const floatBtn = document.getElementById('floatingTouchGuildBtn');
|
const floatBtn = document.getElementById('floatingTouchGuildBtn');
|
||||||
try {
|
try {
|
||||||
const isTouch = (navigator.maxTouchPoints && navigator.maxTouchPoints > 0) || ('ontouchstart' in window);
|
const isTouch = (navigator.maxTouchPoints && navigator.maxTouchPoints > 0) || ('ontouchstart' in window);
|
||||||
if (floatBtn && isTouch) {
|
const w = window.innerWidth || document.documentElement.clientWidth;
|
||||||
|
const h = window.innerHeight || document.documentElement.clientHeight;
|
||||||
|
const isSmallViewport = (h <= 800) || (w/h > 1.6);
|
||||||
|
if (floatBtn && (isTouch || isSmallViewport)) {
|
||||||
floatBtn.classList.remove('hidden');
|
floatBtn.classList.remove('hidden');
|
||||||
floatBtn.addEventListener('click', (e) => { e.preventDefault(); mobileGuildModal?.classList.remove('hidden'); });
|
floatBtn.addEventListener('click', (e) => { e.preventDefault(); mobileGuildModal?.classList.remove('hidden'); });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user