Reputation: 1495
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
Upvotes: 5
Views: 9387
Reputation: 393
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
Upvotes: 3
Reputation: 30666
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';
Upvotes: 8