Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
119
rated 0 times [  126] [ 7]  / answers: 1 / hits: 27316  / 9 Years ago, wed, december 9, 2015, 12:00:00

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


More From » jquery

 Answers
14

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


[#64122] Sunday, December 6, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kiyam

Total Points: 448
Total Questions: 96
Total Answers: 92

Location: Philippines
Member since Sat, Jul 11, 2020
4 Years ago
;