简体   繁体   中英

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. 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

you can use in CSS

overflow:hidden

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

you can use css for this problem if you don't want the scroll to appear

overflow: hidden; 

for more you can refer this overflow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM