Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide scrollbar but keep scroll functionality in react.js

I've tried all methods for vanilla HTML, JS and CSS but it don't seem to work and when it does its not responsive for instance when I reduce the screen it hides but if its Maximized it shows up

Please is there away to solve this issue in material-ui and reactjs

is there a way to make it compatible with various browsers too?

like image 210
Chukwuemeka Maduekwe Avatar asked Feb 20 '20 22:02

Chukwuemeka Maduekwe


People also ask

How do you hide scrollbar in react but still scroll?

This worked for me, i created an external CSS file just like plain HTML and CSS and then linked it to the react file. It's also cross platform. . parentDiv{ width: 100%; height: 100%; overflow: hidden; position: relative; } .

How do I keep the scroll bar in react?

You can apply it by placing the overflow-y:scroll in the id growth inside the style tag. Notice the scroll bar on the right side of the div .

How do you make the scrollbar invisible in react?

Removes scroll bar (by setting overflow: hidden on body), and preserves the scroll bar "gap". Read - it just makes scroll bar invisible.


1 Answers

In 2021:

Add in App.css, and import App.css into App.js

::-webkit-scrollbar {
  display: none;
}
like image 92
gopher166 Avatar answered Oct 15 '22 13:10

gopher166