Code Monkey home page Code Monkey logo

vue-scroll's Introduction

vue-scroll

Recommend to use the scroll implemenation of vuejs event handler

<!-- the scroll event's default behavior (scrolling) will happen -->
<!-- immediately, instead of waiting for `onScroll` to complete  -->
<!-- in case it contains `event.preventDefault()`                -->
<div v-on:scroll.passive="onScroll">...</div>

scroll directive for vuejs 2.0

For vue 1.x, please use [email protected]. Currently its code is in master branch.

NPM

Coveralls

npm package NPM downloads Average time to resolve an issue

Installation

NPM(recommended)

npm install vue-scroll --save

Standalone

Standalone bundle is not support on latest v2.1.0 currently

Simple download from releases and include it in script tag.

Get started

import Vue from 'vue'
import vuescroll from 'vue-scroll'

Vue.use(vuescroll)

Directive v-scroll then can be used in any of your Component.

<template>
  <ul v-scroll="onScroll">
    <li></li>
  </ul>
</template>
...

Method onScroll receives two arguments once scroll event is fired,

  • e - event
  • position - Object contains scrolling data
    • scrollTop Number
    • scrollLeft Number

Advanced

throttle and debounce are supported since v2.1.0, you can enable it as global configurations like:

Vue.use(vuescroll, {throttle: 600})
//Or
Vue.use(vuescroll, {debounce: 600})

Override global configurations like

<ul v-scroll:throttle="{fn: onScroll, throttle: 500 }">
<ul v-scroll:debounce="{fn: onScroll, debounce: 500 }">

Demo

Below two demos are uncommonly used and outdated.

LICENSE

MIT

vue-scroll's People

Contributors

wangpin87 avatar oshnix avatar wmcmurray avatar christianmemije avatar yinjs avatar weichiachang avatar wangpin34 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.