First only select the elements that must call your event callback and not $('html, body, eall, *')
like your question shows you are doing.
For example, add a .horizontalScroll
class to the desired elements and then $('.horizontalScroll
)
Then you can do something like this to make a smoother scroll:
var scroll = $(this).scrollLeft() - (delta * 90);
$(this).stop(true).animate({
scrollLeft: scroll
}, 200);
e.preventDefault();
See this working demo (scroll inside div#scroll
, tweak (delta * 90)
and animate
duration argument 200
to get the desired smoothness.