
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mouse-scroll-smoothing
Advanced tools
Lightweight vanilla smooth scrolling based on native browser scrollbar.
It intends to smooth mouse scrolling, but immediatly cancels easing if user switches to a trackpad or drags on a touch screen (hybrid devices scenario).
Implementing this on a touch only device is not recommanded. You should use a detection library such as detect-it.
npm i mouse-scroll-smoothing --save
import SmoothScroll from 'mouse-scroll-smoothing';
const smoothScroll = new SmoothScroll(domElement, options);
Run npm i && npm start to build the demo.
domElement is the translated DOM.options is an object of options:options.easing [0,1]: easing applied on scroll (every browsers but Firefox).options.easingFf [0,1]: easing applied on scroll (Firefox only).options.autoResize: automatically adds a resize event on window. Set if to false if you already have a listener and want to manually call resize method.options.autoRaf: automatically calls update method on requestAnimationFrame. Set if to false if you already have a RAF running and call update method manually.options.rafCallback: if options.autoRaf is set to true, setting a RAF callback can be useful for animation purposes. The callback with return scroll percent as first param.
options.disablePointerEvents: disable pointer events (set to none) while scrolling (default is true).This method has to be called on window resize event if options.autoResize is false, or anytime you update the domElementcontent.
wh is the window height. Defaults to window.innerHeight. You can use a cached value to limit reflow.Consider debouncing resize call to limit DOM reflow.
This method has to be called on RAF (called automatically if options.autoRaf is true).
now is a boolean, set it to true to force an update without easing.Removes listeners.
Set enabled to false to disable scrolling, true to enable it.
Returns the scroll position in percent. Useful to animate a timeline proportionally to scroll on RAF update.
FAQs
Smooth scrolling based on native browser scrollbar
We found that mouse-scroll-smoothing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.