I'm attempting a horizontal scroll with the mouse wheel, but doesn't seem to work.
Here is my Fiddle
My main class .selector
is the one with scrollable overflow
This is JS I am trying to initialise the scroll with
$('.selector').mousewheel(function(e, delta) {
this.scrollLeft -= (delta * 40);
e.preventDefault();
});
This is the example I am using for horizontal scroll https://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/
Thanks in advance for any help!
EDIT: Thanks all, I forgot jQuery in the Fiddle yeah sorry, but when I was testing on localhost I was using jQuery 1.11.1 so maybe that was the case. Cheers guys
Scroll horizontally using a keyboard and mousePress and hold SHIFT. Scroll up or down using your mouse wheel (or another vertical scrolling function of your mouse).
In most applications, one can scroll horizontally using a combination of holding Ctrl/Shift and using the scrollwheel.
First, if you have the horizontal scroll bar displayed and you have the mouse pointer over that scroll bar, then the mouse wheel will scroll horizontally.
Set the overflow-y: hidden; and overflow-x: auto; that will automatically hide the vertical scroll bar and present only the horizontal scrollbar. The white-space: nowrap; property is used to wrap text in a single line. Here the scroll div will be horizontally scrollable.
You just forget to add JQuery to your html
http://jsfiddle.net/902tjbzz/
jquery.js
: http://code.jquery.com/jquery-2.1.4.min.js
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