[英]How to disable page scroll in html/css/js?
I am using html/css/js to make a website but a scroll is appering because of some effects I added.我正在使用html/css/js制作网站,但由于我添加了一些效果,出现了滚动。 But I don't want a user to see the scrollbar or even scroll with middle mouse button .但我不希望用户看到滚动条,甚至用鼠标中键滚动。 What can I do to solve this problem?我能做些什么来解决这个问题?
Guesswork solution :猜测解决方案:
body { overflow: hidden; }
https://developer.mozilla.org/de/docs/Web/CSS/overflow https://developer.mozilla.org/de/docs/Web/CSS/overflow
you can use in CSS您可以在 CSS 中使用
overflow:hidden
https://developer.mozilla.org/de/docs/Web/CSS/overflow https://developer.mozilla.org/de/docs/Web/CSS/overflow
or if you want to have scrolling but you can hide it或者如果你想滚动但你可以隐藏它
/* Hide scrollbar for Chrome, Safari and Opera */
.example::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.example {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_hide_scrollbar_keep_func https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_hide_scrollbar_keep_func
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.