Skip to content

Commit

Permalink
Mas cambios...
Browse files Browse the repository at this point in the history
  • Loading branch information
mrp500 committed Feb 28, 2024
1 parent 8c25dc3 commit e86e241
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 17 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@ let intentos = 0;
let listaNumerosSorteados = [];
let numeroMaximo = 10;

// Agregar clase al body en dispositivos móviles
// Capturar evento de desplazamiento y evitar el desplazamiento horizontal
document.addEventListener('DOMContentLoaded', function () {
if (window.matchMedia("(max-width: 767px)").matches) {
document.body.classList.add('mobile-no-scroll');
}

var xStart, yStart;

document.addEventListener('touchstart', function (e) {
xStart = e.touches[0].clientX;
yStart = e.touches[0].clientY;
});

document.addEventListener('touchmove', function (e) {
var xMovement = Math.abs(e.touches[0].clientX - xStart);
var yMovement = Math.abs(e.touches[0].clientY - yStart);

if (xMovement > yMovement) {
e.preventDefault();
}
});
});


Expand Down
4 changes: 0 additions & 4 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,11 @@ button {
}

.mobile-no-scroll {
overflow-y: hidden;
position: fixed;
background: linear-gradient(#1354A5 0%, #041832 33.33%, #041832 66.67%, #01080E 100%);
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
top: 0;
bottom: 0;
}

}

0 comments on commit e86e241

Please sign in to comment.