Eu estou tentando parar o corpo da minha página de rolagem (em tudo) enquanto uma sobreposição modal está aberta.
O modal cobre a tela inteira ({position: fixed;top:0;left:0;right:0;bottom:0;}
), e tem sua própria rolagem. No entanto, quando eu corro para o final do pergaminho na minha janela modal, a janela principal começa a rolar por trás dele. Eu tentei tudo o que posso pensar para fazer o corpo parar de rolar. Essas coisas não funcionaram:
CSS
body {
overflow: hidden;
pointer-events: none;
-webkit-overflow-scrolling: none;
}
#content { /* which contains all the non-modal content of the body */
-webkit-transform: scale(0);
position: relative; left: 100%;
}
- usando o iScroll
- bloqueando o evento de rolagem da janela ou do corpo
- bloqueando o evento touchstart no corpo
Respostas:
0 para resposta № 1Parece que você está bem perto.
Quando o seu modal estiver aberto, tente este CSS:
body{
overflow:visible;
max-height:100%; /* or 100px or something smaller than the screen if your viewport isn"t set */
height:100% /* or 100px or something smaller than the screen */
}