Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
jump.js
Advanced tools
Readme
A modern smooth scrolling library.
Jump was developed with a modern JavaScript workflow in mind. To use it, it's recommended you have a build system in place that can transpile ES6, and bundle modules. For a minimal boilerplate that fulfills those requirements, check out outset.
Follow these steps to get started:
Using NPM, install Jump, and save it to your package.json
dependencies.
$ npm install jump.js --save
Import Jump, naming it according to your preference.
// import Jump
import jump from 'jump.js'
Jump exports a singleton, so there's no need to create an instance. Just call it, passing a target.
// call Jump, passing a target
jump('.target')
Note that the singleton can make an infinite number of jumps.
All options, except target, are optional, and have sensible defaults. The defaults are shown below:
jump('.target', {
duration: 1000,
offset: 0,
callback: undefined,
easing: easeInOutQuad,
a11y: false
})
Explanation of each option follows:
Scroll from the current position by passing a number of pixels.
// scroll down 100px
jump(100)
// scroll up 100px
jump(-100)
Or, scroll to an element, by passing either:
// passing a node
const node = document.querySelector('.target')
jump(node)
// passing a CSS selector
// the element referenced by the selector is determined using document.querySelector
jump('.target')
Pass the time the jump()
takes, in milliseconds.
jump('.target', {
duration: 1000
})
Or, pass a function that returns the duration of the jump()
in milliseconds. This function is passed the jump()
distance
, in px
, as a parameter.
jump('.target', {
duration: distance => Math.abs(distance)
})
Offset a jump()
, only if to an element, by a number of pixels.
// stop 10px before the top of the element
jump('.target', {
offset: -10
})
// stop 10px after the top of the element
jump('.target', {
offset: 10
})
Note that this option is useful for accommodating position: fixed
elements.
Pass a function that will be called after the jump()
has been completed.
// in both regular and arrow functions, this === window
jump('.target', {
callback: () => console.log('Jump completed!')
})
Easing function used to transition the jump()
.
jump('.target', {
easing: easeInOutQuad
})
See easing.js for the definition of easeInOutQuad
, the default easing function. Credit for this function goes to Robert Penner.
If enabled, and scrolling to an element:
jump('.target', {
a11y: true
})
Note that this option is disabled by default because it has visual implications in many browsers. Focusing an element triggers the :focus
CSS state selector, and is often accompanied by an outline
.
Jump depends on the following browser APIs:
Consequently, it supports the following natively:
To add support for older browsers, consider including polyfills/shims for the APIs listed above. There are no plans to include any in the library, in the interest of file size.
MIT. © 2016 Michael Cavalea
FAQs
A modern smooth scrolling library.
The npm package jump.js receives a total of 61,779 weekly downloads. As such, jump.js popularity was classified as popular.
We found that jump.js 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
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.