Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal scroll with mouse wheel on horizontal list

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

like image 664
Sanction Avatar asked Dec 09 '15 14:12

Sanction


People also ask

How do I make my mouse wheel scroll horizontally?

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).

How do you enable horizontally scroll in Excel with mouse wheel?

In most applications, one can scroll horizontally using a combination of holding Ctrl/Shift and using the scrollwheel.

How do I scroll horizontally with mouse wheel in Word?

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.

How do I create a horizontal scrolling container?

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.


1 Answers

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

like image 112
Aelios Avatar answered Oct 18 '22 22:10

Aelios