Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@bva/vue-sticky-directive
Advanced tools
Vue directive to enable sticky scrolling on navigation elements such as headers and sidebars.
Makes any Vue component or element sticky – scrolls at a fixed position in the viewport. Specially useful for main navigation headers, sidebars, and more.
@bva/stickie
(which in turn is dependency free).ResizeObserver
and matchMedia
to detect changes to the interface, caching calculated properties, etc.From your favorite CLI using yarn:
yarn add @bva/vue-sticky-directive
Or npm:
npm install @bva/vue-sticky-directive
import Sticky from '@bva/vue-sticky-directive';
Vue.use(VueStickyDirective);
import Sticky from '@bva/vue-sticky-directive';
export default {
name: 'componentName',
directives: {
Sticky
},
};
Usage is as simple setting the v-sticky
directive:
<template>
<div v-sticky>
A sticky element
</div>
</template>
<script>
...
</script>
You can also pass options if needed. Directly in the directive:
<template>
<div v-sticky="{ contained: true, offset: 20 }">
A sticky element
</div>
</template>
<script>
...
</script>
Or from a Vue object:
<template>
<div v-sticky="stickyOptions">
A sticky element
</div>
</template>
<script>
export default {
...,
data() {
return {
stickyOptions: {
contained: true,
offset: 20,
},
};
},
...,
};
</script>
All options available in @bva/stickie
are also available to this directive. Head over its documentation to learn more: https://www.npmjs.com/package/@bva/stickie#options
All events fired by @bva/stickie
https://www.npmjs.com/package/@bva/stickie#events can be handled through this directive.
You can use Vue’s standard @
notation as well as v-on
:
<template>
<div v-sticky @sticky:active="onStickyActive">
A sticky element
</div>
</template>
<script>
export default {
...,
methods: {
onStickyActive() {
console.log('Sticky is now active!');
},
},
...,
};
</script>
Accessing event data can be done through the event’s details
object on the listener binding:
<template>
<div v-sticky @sticky:active="(evt) => onStickyActive(evt.detail)">
A sticky element
</div>
</template>
<script>
export default {
...,
methods: {
onStickyActive(data) {
console.log('Sticky is now active!');
console.log('Event data:', data);
},
},
...,
};
</script>
Or simply access it directly on the handler:
<template>
<div v-sticky @sticky:active="onStickyActive">
A sticky element
</div>
</template>
<script>
export default {
...,
methods: {
onStickyActive({ details }) {
console.log('Sticky is now active!');
console.log('Event data:', details);
},
},
...,
};
</script>
FAQs
Vue directive to enable sticky scrolling on navigation elements such as headers and sidebars.
The npm package @bva/vue-sticky-directive receives a total of 35 weekly downloads. As such, @bva/vue-sticky-directive popularity was classified as not popular.
We found that @bva/vue-sticky-directive 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.