我想问
我有一个显示隐藏菜单(openNav,closeNav)
这是我的 javascript :
function openNav() {
document.getElementById("mySidenav").style.width = "100%";
// document.getElementById("flipkart-navbar").style.width = "50%";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.body.style.backgroundColor = "rgba(0,0,0,0)";
}
这是我的 css 脚本:
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #fff;
overflow-x: hidden;
transition: 0.5s;
box-shadow: 0 4px 8px -3px #555454;
padding-top: 0px;
}
我尝试添加 overflow-y: hidden;但不工作
我尝试将 overflow:visible 或 auto not work 更改为
我尝试将位置更改为绝对位置或相对位置对先生不起作用
滚动仍然显示
这是我的截图:
从我的截图中看到滚动条,滚动条显示没有隐藏或禁用
先生,如何隐藏或禁用滚动条?
先谢谢
最佳答案
尝试
overflow: hidden;
height:100vh;
width: 100vh;
关于css - 如何禁用 sidenav 上的滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50733754/