I'm trying to disable horizontal scroll on a website; but allowing vertical scrolling.
I have a script which works like a slider by sliding the 'body' of the page left and revealing more contents. However this creates extra empty space on the right.
I need to disable horizontal scrolling so users don't see this empty space. I tried the following script but it disables both horizontal and vertical scrolling:
window.onscroll = function () {
window.scrollTo(0,0);
}
I have tried overflow-x: hidden but that doesn't work when the body's width is dynamic and not static.
Question:
Is there a way to modify the above script to disable the horizontal scrolling and keep vertical scrolling?