To allow an element (for example, a <div> ) to scroll using the trackpad, but not to allow the browser to return to the previous page, you need to prevent the default browser from working.
You can do this by listening to the mousewheel event on the element. Using the element’s scroll properties and deltaX / Y properties in an event, you can prevent and stop the default action when it falls below zero or above width / height.
You can also use delta information to manually scroll when you prevent the entire scroll operation. This allows you to actually go to zero, rather than stopping at 10 pixels or something like that.
This works on Chrome, Safari and Firefox on Mac. I have not tested IE.
This decision will only affect this element and allow the rest of the page to behave as usual. Thus, you can use your browser as expected and return the page, but being inside the element, you will not accidentally return when you do not want.
user835542 Nov 19 '14 at 18:05 2014-11-19 18:05
source share