Is there a way to use Javascript or jQuery to change the direction of scrolling on an HTML page (with mouse wheel) from up to down -> left to right?
Here is a short function that makes your document scroll horizontally instead of vertically using the mousewheel:
$(function() {
$("html, body").mousewheel(function(event, delta) {
this.scrollLeft -= (delta * 30);
event.preventDefault();
});
});
You will need to include the jquery.mousewheel.min.js script in your page for it to work.
Working JSFiddle example: https://jsfiddle.net/1zugp6w6/1/
Source
$(document).ready(function() {
$('html, body, *').mousewheel(function(e, delta) {
this.scrollLeft -= (delta * 40);
e.preventDefault();
});
});
that work for all browser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With