
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
transcroll
Advanced tools
Animate scroll in a flexible, user-friendly, simple and modern way.
Install with npm i transcroll
.
Usage:
import transcroll, { easings } from './index';
// animate to an element
transcroll(document.querySelector('#whatever'));
// animate to an element by selector string
transcroll('#whatever');
// animate to position
transcroll(200);
// configuration options and default values
transcroll(whatever, {
// scrollable container element
el: window,
// scrolling axis, 'x' or 'y'
axis: 'y',
// animation duration
duration: 200,
// transition easing function, can be a function or a string with an easings object key
easing: easings.easeInQuad,
// jump factor or false to disable (more information below)
jump: 2,
// immediately stop animation if user uses a mousewheel
interrupt: true
});
// do something on animation end
transcroll(whatever).then(({
// animation started after "jump" is triggered
jumped,
// animation was interrupted by user
interrupted
}) => doSomething());
jump
argument is used to calculate a threshold value which is used to prevent animating too big distances in a
short period of time.
threshold = duration * jumpFactor
You can feel same behavior in the Telegram application when trying to scroll to the last message in a chat after scrolling back to some old messages about 4-5 screens.
FAQs
Animate scroll in a modern way
The npm package transcroll receives a total of 3 weekly downloads. As such, transcroll popularity was classified as not popular.
We found that transcroll 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.