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.
vue3-smooth-scroll
Advanced tools
Lightweight Vue plugin for smooth-scrolling extended from vue2-smooth-scroll.
For simple use-cases, the native scroll-behavior
CSS property (working draft) may be enough.
requestAnimationFrame
(with fallback)npm install --save vue3-smooth-scroll
import { createApp } from 'vue'
import VueSmoothScroll from 'vue3-smooth-scroll'
const app = createApp(...)
app.use(VueSmoothScroll)
<body>
<script src="https://unpkg.com/vue@next"></script>
<script src="https://unpkg.com/vue3-smooth-scroll"></script>
<script>
const app = Vue.createApp(...)
app.use(VueSmoothScroll)
</script>
</body>
<a href="#sec-3" v-smooth-scroll>Section 3</a>
<section id="sec-3"></section>
methods: {
scrollToMyEl () {
const myEl = this.$refs.myEl || this.$el || document.getElementById(...)
this.$smoothScroll({
scrollTo: myEl, // scrollTo is also allowed to be number
hash: '#sampleHash' // required if updateHistory is true
})
}
}
import { inject, ref } from 'vue'
setup () {
const myEl = ref(null)
const smoothScroll = inject('smoothScroll')
const scrollToMyEl = () => {
smoothScroll({
scrollTo: myEl.value,
hash: '#sampleHash'
})
}
}
{
duration: 500, // animation duration in ms
offset: 0, // offset in px from scroll element, can be positive or negative
container: '', // selector string or Element for scroll container, default is window
updateHistory: true, // whether to push hash to history
easingFunction: null // gives the ability to provide a custom easing function `t => ...`
// (see https://gist.github.com/gre/1650294 for examples)
// if nothing is given, it will defaults to `easeInOutCubic`
}
const app = createApp(...)
app.use(VueSmoothScroll, {
duration: 400,
updateHistory: false
})
<div id="container">
<a href="#div-id" v-smooth-scroll="{ duration: 1000, offset: -50, container: '#container' }">Anchor</a>
<div id="div-id"></div>
</div>
this.$smoothScroll({
scrollTo: this.$refs.myEl,
duration: 1000,
offset: -50,
})
const smoothScroll = Vue.inject('smoothScroll')
smoothScroll({
scrollTo: refs.myEl,
duration: 1000,
offset: -50,
})
FAQs
Simple vue smooth scroll
The npm package vue3-smooth-scroll receives a total of 1,073 weekly downloads. As such, vue3-smooth-scroll popularity was classified as popular.
We found that vue3-smooth-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.