Can we disable two finger scroll in Mac/book,using javaScript

1k views Asked by At

Hello i have a situation , I have a div container with a width of 300px and position relative and overflow hidden ,and i have two other child div inside it with position absolute, i'm translating them using css3 -transform: translate3d(0, 0, 0) then on click transform: translate3d(-400px, 0, 0); vice versa ,its working fine on windows but on Mac/macbook system while using two finger scroll the div container is overflowing and able to see the transmitted div(sometime white empty space)

1

There are 1 answers

0
ianaya89 On

I don't think you can do that. There is no two finger scroll on MAC, is just scroll (two finger is the way that use a MAC to interact with the hardware).

If you want to prevent scrolling on MAC you need to identify if is a MAC computer and then set overflow hidden for your div or do what you need to do.

You could do something like this:

var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0;

if (isMac) {
  document.getElementById('container').style.overflow = 'hidden';
}