0.0.4 • Published 8 years ago

vue-sticky-js v0.0.4

Weekly downloads
59
License
MIT
Repository
github
Last release
8 years ago

vue-sticky-js

Vue.js directive to make sticky elements built on sticky-js

Prerequisites

Vue.js

Installation

$ npm i -S vue-sticky-js

Directive

v-sticky => Define a new sticky element.

Implementation

Global

main.js

import Vue     from 'vue';
import VueSticky from 'vue-sticky-js';

Vue.use(VueSticky.install);

// ...

Component.vue

<script>
  export default {
    name: 'Component',

    data() {
      return {
        stickyOptions: {
          marginTop: 20,
          forName: 0,
          className: 'stuck'
        }
      };
    }

  };
</script>

<template lang='pug'>
  .container
    .box(v-sticky='stickyOptions') //- stickyOptions are not mandatory
      p Sticky Element
</template>

Component

Component.vue

<script>
  import { stickyDirective } from 'vue-sticky-js';

  export default {
    name: 'Component',

    directives: {
      s: stickyDirective // You can name it as you want.
    }

  };
</script>

<template lang='pug'>
  .container
    .box(v-s) //- stickyOptions are not mandatory
      p Sticky Element
</template>

Development Setup

# install dependencies
$ npm install

# dev mode
$ npm run dev

# test
$ npm run test

# build
$ npm run build

This project was built with yeoman and generator-vue-component :heart:

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago