vue-sticky-directive-ts

A powerful vue directive make element sticky.
796
Install
npm install vue-sticky-directive-ts
Latest Version:0.0.17
Vue:2 · 3
License:MIT
Last Updated:May 26, 2023
Links: GitHub  ·  npm
Maintainer: oruman

vue-sticky-directive-ts

vue-sticky-directive-ts is a powerful vue directive make element sticky and fork of vue-sticky-directive

Install

Using npm:

NPM

npm install vue-sticky-directive-ts --save

Using yarn:

yarn add vue-sticky-directive-ts

ES2015

// register globally
import Sticky from 'vue-sticky-directive-ts'
Vue.use(Sticky)

Usage

Use v-sticky directive to enable element postion sticky. Sticky element will find its nearest element with sticky-container attribute or its parent node if faild as the releative element.

<div sticky-container>
  <div v-sticky="{
    topOffset: 0,
    bottomOffset: 0,
    side: 'top',
    zIndex: 10,
    on: () => {}
  }">
    ...
  </div>
</div>

In styles set position for sticky-container.

[sticky-container] {
  position: relative;
}

Options

  • topOffset(number) - set the top breakpoint offset (default: 0)
  • bottomOffset(number) - set the top breakpoint offset (default: 0)
  • side(string) - decide which side should be sticky, you can set top,bottom or both (default: top)
  • zIndex(number) - to set the z-index of element to stick
  • on (function) - callback when sticky and release, receiveing 1 argument with object indicating the state, like:
// The element is sticked on top
{
  bottom: false,
  top: true,
  sticked: true
}

License

MIT

Related Packages

@renatodeleao/vue-sticky-directive

A Vue directive wrapping https://github.com/abouolia/sticky-sidebar to make smar...

25,053 17
vue22-sticky-directive

A Vue directive wrapping https://github.com/abouolia/sticky-sidebar to make smar...

4,854 17
v-idle

A universal Vue plugin compatible with Vue 2 and Vue 3 to detect idle/non-active...

174,297 69
vue3-sticky-directive

Vue3-sticky-directive is a powerful Vue 3 directive make element sticky. This is...

75,838 4
lkl-zf-ss-htk-uis-h5

汇拓客ui库

782 0

Version History

Version Released Vue License
0.0.17 ^2.0.0 || >=3.0.0 MIT
0.0.16 ^2.0.0 || >=3.0.0 MIT
0.0.15 ^2.0.0 || >=3.0.0 MIT
0.0.14 ^2.0.0 || >=3.0.0 MIT
0.0.13 ^2.0.0 || >=3.0.0 MIT