vue-scroll-check

A simple component based on Vue.js. Detects if an element has scrolled to bottom, top or middle in itself.
968 5
Install
npm install vue-scroll-check
Latest Version:0.1.9
Vue:2
License:MIT
Last Updated:Apr 1, 2021
Links: GitHub  ·  npm
Maintainer: dgknca

vue-scroll-check

A simple component based on Vue.js. Detects if an element has scrolled to bottom, top or middle in itself.

Demo

Live Demo | Codesandbox

Install

NPM

npm i vue-scroll-check

Props

Props Description Type Default
scrollAreaClass Classes of the component's scrollable child element. String
:threshold Threshold value of event change. Number 0

Events

Events
onBottomReach
onBottomLeave
onTopReach
onTopLeave
onMiddleEnter
onMiddleLeave

Usage

<v-scroll-check
  scrollAreaClass="list"
  :threshold="100"
  @onBottomReach="onBottomReach"
  @onBottomLeave="onBottomLeave"
  @onTopReach="onTopReach"
  @onTopLeave="onTopLeave"
  @onMiddleEnter="onMiddleEnter"
  @onMiddleLeave="onMiddleLeave"
>
  <!-- Send your contents as slot -->
  <div class="item" v-for="i in 50" :key="i">Item {{ i }}</div>
</v-scroll-check>

<script>
  import VScrollCheck from 'vue-scroll-check'

  export default {
    components: {
      VScrollCheck
    },
    methods: {
      onBottomReach() {
        console.log('onBottomReach')
      },
      onBottomLeave() {
        console.log('onBottomLeave')
      },
      onTopReach() {
        console.log('onTopReach')
      },
      onTopLeave() {
        console.log('onTopLeave')
      },
      onMiddleEnter() {
        console.log('onMiddleEnter')
      },
      onMiddleLeave() {
        console.log('onMiddleLeave')
      }
    }
  }
</script>

<style>
  /* Don't forget that! The scrollAreaClass must be scrollable. */
  .list {
    height: 500px;
    overflow: auto;
  }
</style>

Related Packages

webcake-ui-kit

UI Kit for Vue 2 && 3 - Pure Options API

19,775 8
yn-components

Advanced and highly reusable Mobile UI Components built on Vue2 & You can define...

3,128 6
vue-login-test

Componete vue kt

708
tinymce-vue-2

A vue 2 component for TinyMCE

27,768 48
@zeit-ui/vue

A popular UI framework for Vue

4,030 704

Version History

Version Released Vue License
0.1.9 ^2.6.12 MIT
0.1.8 ^2.6.12 MIT
0.1.7 ^2.6.11 MIT
0.1.5 ^2.6.11 MIT
0.1.4 ^2.6.11 MIT