Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
animated-scroll
Advanced tools
Allows animating scrollTop
and/or scrollLeft
of an HTML element. Uses
requestAnimationFrame
to provide smooth animations and returns a Promise
to
notify when the animation is completed.
Install with bower:
bower install animated-scroll
Or with npm:
npm install animated-scroll
Or simply download the latest release.
The pre-built files can be found in the dist/
directory.
dist/AnimatedScroll.min.js
is minified and production-ready. It has a UMD
wrapper so you can access it as:
var AnimatedScroll = require('animated-scroll');
// or
import AnimatedScroll from 'animated-scroll';
// or
define([ 'path/to/animated-scroll' ], function (AnimatedScroll) {});
// or
var AnimatedScroll = window.AnimatedScroll;
var element = document.getElementById('myElement');
var scroll = new AnimatedScroll(element);
scroll.top(100).then(function (newTop) {
// newTop === 100
console.log('#myElement\'s scrollTop is now', newTop);
});
scroll.left(100).then(function (newLeft) {
// newLeft === 100
console.log('#myElement\'s scrollLeft is now', newLeft);
});
scroll.to({ left: 100, top: 100 }).then(function (coords) {
console.log('#myElement\'s scrollTop is now', coords.top);
console.log('#myElement\'s scrollLeft is now', coords.left);
});
Animates the scrollTop of element
from it's current scrollTop
to the new
scrollTop
in a time-frame of duration
and using the provided easing
function (duration
and easing
are optional).
It returns a promise which is resolved with the value of the new scrollTop
when the animation is complete.
duration
is in milliseconds and defaults to 400 if not provided. If set to 0
or false
, then the scrollTop
is set without animating. In this case an
already fulfilled promise is returned.
If no easing
is provided and duration
is provided then the default easing
function used is easeInOutQuad
.
Calling .top
on an element while a scrollTop
animation is currently ongoing
will stop that animation and start a new one i.e. animations are not queued. You
can queue animations by hooking into the .then
of the returned promise.
Exactly the same as .top
but for scrollLeft
:)
Convinient way to animate both scrollTop
and scrollLeft
. Accepts an object
with top
and left
properties and returns a promise which resolves with an
object containing the new top
and left
values.
Stops any currently-running animation of scrollTop
.
Stops any currently-running animation of scrollLeft
.
Stops any currently-running animation of scrollLeft
or scrollTop
.
Contributions are welcomed! Here are the contribution guidelines.
First clone the repository and install dependencies:
npm install
To run tests:
npm test
To lint the code:
npm run lint
To make a production build:
npm run build
FAQs
Animate scrollTop and scrollLeft
The npm package animated-scroll receives a total of 5 weekly downloads. As such, animated-scroll popularity was classified as not popular.
We found that animated-scroll 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.