Coder Social home page Coder Social logo

dgknca / vue-scroll-check Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 1.41 MB

Detects if an element has scrolled to bottom, top or middle in itself.

Home Page: https://dgknca.github.io/vue-scroll-check/

JavaScript 8.15% Vue 91.85%
vue-scroll vue-scroll-detect vue-scroll-check

vue-scroll-check's Introduction

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>

vue-scroll-check's People

Contributors

dgknca avatar iujlaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

iujlaki

vue-scroll-check's Issues

This dependency was not found

When importing this package i get an error that the dependency was not found:

Things I tried:

  • installing the npm package
  • deleting node modules and installing all the packages
  • trying to get the package with require("vue-scroll-check/src/components/ScrollCheck.vue").default
  • trying to get the package with require("vue-scroll-check/src/components/ScrollCheck.vue")
    image

Thanks for the help

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.