Skip to content

Vue directive to detect resize events with deboucing and throttling capacity.

License

Notifications You must be signed in to change notification settings

aleksei-a-savitski/Vue.resize

 
 

Repository files navigation

Vue.resize

GitHub open issues GitHub closed issues Npm download Npm version vue2 MIT License

Vue directive to detect HTML resize events based on CSS Element Queries with deboucing and throttling capacity.

Demo

demo gif

Typical usage

Simple

Use this option when you need to receive all the resize events.

<div v-resize="onResize">

Throttle

Use throttle when you need to rate-limit resize events frequency.

  • With default timeout (150 ms):
<div v-resize:throttle="onResize">
  • With custom timeout (in ms):
<div v-resize:throttle.100="onResize">

Debounce

Use debounce when you only need to be notified when resize events ends.

  • With default timeout (150 ms):
<div v-resize:debounce="onResize">
  • With custom timeout (in ms):
<div v-resize:debounce.50="onResize">

Installation

  • Available through npm:
 npm install vue-resize-directive --save
  • For Modules
// ES6
import resize from 'vue-resize-directive'
//...
export default {
    directives: {
        resize,
    }
//...
  
// ES5
var resize = require('vue-resize-directive')
  • For <script> Include

    Just include Vueresize.js after ResizeSensor.js from css-element-queries and lodash.js script.

About

Vue directive to detect resize events with deboucing and throttling capacity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 84.2%
  • Vue 14.5%
  • HTML 1.3%