10

I have a div with a fixed height and in it a ul-list and many li-items. I apply to the div a jScrollPane for which I want to customize the appearance of the scrollbar. My code is like:

$(function() {
    $('.myDiv').jScrollPane( { showArrows: true, arrowScrollOnHover: true, wheelSpeed: 120 });
});

As jScrollPane I use the scripts of http://jscrollpane.kelvinluck.com and it is kind of working. But the speed of the mouse wheel (velocity of scrolling) is much too slow although I tried to set the speed up as you can see in my example above.

Does anybody has had the same effect and can give me a hint how I can speed it up?

Pang
  • 9,564
  • 146
  • 81
  • 122
parascus
  • 1,079
  • 1
  • 10
  • 14
  • I think it'd be best to change the correct answer to Sargin Sargin's, if that also works for you. It's a better way of setting a custom scroll rate for an instance of the plugin. – andrewb Feb 24 '14 at 21:45

2 Answers2

16

You have to define the wheel speed when you initialize the plugin like this:

$('.scroll-pane').jScrollPane({
    mouseWheelSpeed: 50
});
Ahmad Alfy
  • 13,107
  • 6
  • 65
  • 99
Abdullah SARGIN
  • 1,646
  • 1
  • 13
  • 19
  • Notice that `mouseWheelSpeed` won't work in IE8 or below if you use jquery.mousewheel.js greater than 3.1.5 (jScrollPane current version: 2.0.21) – Light Mar 24 '15 at 03:29
11

In the jquery.jscrollpane.js (or even .min.js file), find "mouseWheelSpeed" in the "defaults". This was 3 for me originally, I bumped it up to 30. Perhaps it is 3 or 30 pixles/click.

Edit

Sargin Sargin's answer is probably better for most cases. Given his solution, editing the plugin file would only make sense if you wanted to set a new default for reuse around a site. You'd also need to make note of changes made so that you don't lose your customisation when you update the file.

andrewb
  • 5,200
  • 6
  • 36
  • 54
  • Whoppa! Thanks andrewb. That did it! – parascus Jun 18 '13 at 16:20
  • I found that IE scrolled 31px, Webkit (Opera, Safari, Chrome) scrolled 33px, and FF scrolled 42px. There's no way of detecting the actual delta except by capturing a scroll event and measuring the `scrollTop` value. – Barney Jul 10 '13 at 14:58