Skip to content

Commit

Permalink
Desactiva el scroll vertical en móviles
Browse files Browse the repository at this point in the history
  • Loading branch information
mrp500 committed Feb 28, 2024
1 parent 9bdc9b5 commit 7ee9750
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ let intentos = 0;
let listaNumerosSorteados = [];
let numeroMaximo = 10;

// Deshabilitar el desplazamiento vertical en dispositivos móviles
// Agregar clase al body en dispositivos móviles
document.addEventListener('DOMContentLoaded', function () {
if (window.matchMedia("(max-width: 767px)").matches) {
document.body.style.overflowY = 'hidden';
document.body.classList.add('mobile-no-scroll');
}
});

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<title>JS Game</title>
</head>

<body>
<body class="mobile-no-scroll">

<div class="container">
<div class="container__contenido">
Expand Down
6 changes: 5 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ button {
font-weight: 400;
}

@media only screen and (max-width: 600px) {
@media only screen and (max-width: 767px) {

.container__informaciones {
flex: 1;
Expand All @@ -123,4 +123,8 @@ button {
padding-bottom: 0;
}

.mobile-no-scroll {
overflow-y: hidden;
}

}

0 comments on commit 7ee9750

Please sign in to comment.