
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
vanilla-smoothie
Advanced tools
You can install using npm or yarn and this method is recommended.
npm install --save vanilla-smoothie
You can also use CDN. Suitable for creating small websites and samples.
<script src="https://cdn.jsdelivr.net/npm/vanilla-smoothie@2.2.5/dist/vanilla-smoothie.min.js"></script>
You can achieve smooth scroll with a simple and intuitive way of writing.
In addition, you can write any way you like, such as Callback or Promise.
const vanillaSmoothie = require('vanilla-smoothie')
// Use callback
vanillaSmoothie.scrollTo('#anchor-01', {
duration: 800
}, () => {
console.log('Scrolled!!')
})
// Use Promise
vanillaSmoothie.scrollTo('#anchor-02', {
duration: 800
}).then(() => {
console.log('Scrolled!!')
})
// Use async/await
(async () => {
await vanillaSmoothie.scrollTo('#anchor-03', {
duration: 800
})
console.log('Scrolled!!')
})()
Sample code to easily implement the anchor link.
document.querySelectorAll('a[href^="#"]').forEach((anchor) => {
anchor.addEventListener('click', (event) => {
vanillaSmoothie.scrollTo(event.target.getAttribute('href'), {
duration: 500
})
})
})
Scroll to a specified destination.
For target
, selector or offset is entered. When the selector is specified for the target
, the target element is focused after scroll.
Refer to Option for option parameter.
// Selector
vanillaSmoothie.scrollTo('#id-name')
// Offset Top
vanillaSmoothie.scrollTo(300)
// with option and callback
vanillaSmoothie.scrollTo('#id-name', {
duration: 1000
}, () => {
console.log('Callback')
})
Scroll to the top of the page.
Refer to Option for option parameter.
vanillaSmoothie.scrollTop(1000, () => {
console.log('Callback')
})
Scroll to the bottom of the page.
Refer to Option for option parameter.
vanillaSmoothie.scrollBottom(1000, () => {
console.log('Callback')
})
Option | Type | Description | default |
---|---|---|---|
element | object | Target scroll element. | window |
duration | number | Default number of milliseconds to scroll. | 500 |
adjust | number | Enter a value when you want to adjust the scroll position. | 0 |
easing | string | Easing name. | linear |
![]() Edge | ![]() Firefox | ![]() Chrome | ![]() Safari | ![]() iOS Safari |
---|---|---|---|---|
Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
Please create an Issue or Pull requests if you have any improvements!
Use yarn to download packages and run scripts.
Before creating a Pull requests, execute yarn test
and check the operation of the library.
# Install packages
yarn
# TypeScript compile and launch local server to http://localhost:3000
yarn dev
# Build TypeScript and Document
yarn build
# Check TypeScript syntax
yarn lint
# Run E2E test
yarn test
Other commands look to package.json
.
[v2.2.5] 2020-09-23
FAQs
A minimal smooth scroll library based on vanilla JavaScript.
We found that vanilla-smoothie 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.