/** * Prevent horizontal page drag on mobile (keeps vertical scroll + table scroll areas). */ (function () { if (window.matchMedia('(min-width: 993px)').matches) { return; } let startX = 0; let startY = 0; document.addEventListener( 'touchstart', function (e) { if (e.touches.length !== 1) { return; } startX = e.touches[0].clientX; startY = e.touches[0].clientY; }, { passive: true } ); document.addEventListener( 'touchmove', function (e) { if (e.touches.length !== 1) { return; } if (e.target.closest('.table-responsive')) { return; } const dx = Math.abs(e.touches[0].clientX - startX); const dy = Math.abs(e.touches[0].clientY - startY); if (dx > dy && dx > 8) { e.preventDefault(); } }, { passive: false } ); })();