2

I am working on a project that need to scroll using button and not using touch scrolling.

For this purpose, I have used a pure JavaScript code that I am sharing below, but this is stopping all the scrolling even Up / Down too. I just want to stop Horizontal scrolling in touch screen.

I think that it will be done by offsetX or pageX, but I am not able to mix this with below code. Hoping that you can make this...

<script type='text/javascript'>
// Stop Left/Right/Up/Down Scrolling In TouchScreen
window.addEventListener("touchmove", function(event) {
event.preventDefault();
}, false);
</script>
Bhushan Kawadkar
  • 28,279
  • 5
  • 35
  • 57
Muhammad Hassan
  • 1,224
  • 5
  • 31
  • 51

1 Answers1

0

You could just use CSS to disable horizontal scrolling:

div{
  overflow-x: hidden;
}
Git Paul
  • 211
  • 2
  • 4