Possible to adjust speed? #350
Answered
by
idiotWu
jesperlandberg
asked this question in
Q&A
-
Hi, Is it possible to adjust the speed of the scrolling also? not only damping. |
Beta Was this translation helpful? Give feedback.
Answered by
idiotWu
Oct 26, 2017
Replies: 1 comment 3 replies
-
For [email protected], you can use the plugin system to do this: import Scrollbar, { ScrollbarPlugin } from 'smooth-scrollbar';
class ScaleSpeedPlugin extends ScrollbarPlugin {
static pluginName = 'scaleSpeed';
static defaultOptions = {
speed: 1,
};
transformDelta(delta) {
const { speed } = this.options;
return {
x: delta.x * speed,
y: delta.y * speed,
};
}
}
Scrollbar.use(ScaleSpeedPlugin);
Scrollbar.init(elem, {
plugins: {
scaleSpeed: {
speed: 10,
},
},
}); |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
idiotWu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For [email protected], you can use the plugin system to do this: