Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove horizontal scroll

Im trying to remove the horizontal scroll.

Currently using "overflow-x: hidden;" does the job of hidden the scroll but its still actually functional if you were to use the tracker page etc. I'm thinking it would be best to disable it with Javascript, any ideas on what I could use?

Many thanks

like image 239
Rob Avatar asked Feb 22 '23 18:02

Rob


2 Answers

Well, showing/hiding the scrollbars is a visual thing so in any ways, you're going to change the css to achieve this.

Now, if this is what you're asking, you can change the styles through javascript instead of using a stylesheet:

document.documentElement.style.overflowX = 'hidden';
document.documentElement.style.overflowY = 'hidden';

// or for an element
document.getElementById('mydiv').style.overflowX = 'hidden';
like image 82
Didier Ghys Avatar answered Mar 04 '23 17:03

Didier Ghys


There isn't really another way beside using the css property in javascript like so:

 document.documentElement.style.overflowX = 'hidden';    // horizontal scrollbar will be hidden
 document.documentElement.style.overflowY = 'hidden';    // vertical scrollbar will be hidden
like image 31
dimitril Avatar answered Mar 04 '23 19:03

dimitril