All Projects → p0o → react-is-scrolling

p0o / react-is-scrolling

Licence: MIT license
Simply detect if users are scrolling in your components in a declarative API

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-is-scrolling

V Bar
The virtual responsive crossbrowser scrollbar component for VueJS 2x
Stars: ✭ 216 (+1170.59%)
Mutual labels:  scrolling, scroll, scrollbar
Fuckmyscroll.js
🔮 Animated scrolling to certain point or anchor
Stars: ✭ 10 (-41.18%)
Mutual labels:  scrolling, scroll
Horizontal Scroll
Horizontal scroll with inertia
Stars: ✭ 175 (+929.41%)
Mutual labels:  scrolling, scroll
Pd Select
vue components ,like ios 3D picker style,vue 3d 选择器组件,3D滚轮
Stars: ✭ 101 (+494.12%)
Mutual labels:  scrolling, scroll
Infinitescroll
Infinite Scroll (Endless Scrolling) for RecyclerView in Android
Stars: ✭ 183 (+976.47%)
Mutual labels:  scrolling, scroll
Txscrolllabelview
🌭TXScrollLabelView, the best way to show & display information such as adverts / boardcast / onsale e.g. with a customView.
Stars: ✭ 714 (+4100%)
Mutual labels:  scrolling, scroll
Dragscroll
micro library for drag-n-drop scrolling style
Stars: ✭ 989 (+5717.65%)
Mutual labels:  scrolling, scroll
React Scrolllock
🔒 Prevent scroll on the <body />
Stars: ✭ 393 (+2211.76%)
Mutual labels:  scrolling, scroll
Jquery Scrolllock
Locks mouse wheel scroll inside container, preventing it from propagating to parent element
Stars: ✭ 109 (+541.18%)
Mutual labels:  scrolling, scroll
Ngx Ui Scroll
Infinite/virtual scroll for Angular
Stars: ✭ 145 (+752.94%)
Mutual labels:  scrolling, scroll
Stickyfill
Polyfill for CSS `position: sticky`
Stars: ✭ 2,252 (+13147.06%)
Mutual labels:  scrolling, scroll
React Indiana Drag Scroll
React component which implements scrolling via holding the mouse button or touch
Stars: ✭ 190 (+1017.65%)
Mutual labels:  scrolling, scroll
Scrolldir
0 dependency JS plugin to leverage scroll direction with CSS ⬆⬇ 🔌💉
Stars: ✭ 679 (+3894.12%)
Mutual labels:  scrolling, scroll
Scroll Js
Light cross-browser scroller that uses native javascript
Stars: ✭ 179 (+952.94%)
Mutual labels:  scrolling, scroll
Recyclerview Fastscroller
A fully customizable Fast Scroller for the RecyclerView in Android, written in Kotlin
Stars: ✭ 585 (+3341.18%)
Mutual labels:  scrolling, scroll
Android scroll endless
Scroll endless for Android recyclerview
Stars: ✭ 12 (-29.41%)
Mutual labels:  scrolling, scroll
Jump.js
A modern smooth scrolling library.
Stars: ✭ 3,459 (+20247.06%)
Mutual labels:  scrolling, scroll
Mac Mouse Fix
Mac Mouse Fix - A simple way to make your mouse better.
Stars: ✭ 362 (+2029.41%)
Mutual labels:  scrolling, scroll
Prognroll
A tiny, lightweight jQuery plugin that creates scroll progress bar on the page.
Stars: ✭ 108 (+535.29%)
Mutual labels:  scrolling, scroll
Moveto
A lightweight scroll animation javascript library without any dependency
Stars: ✭ 2,746 (+16052.94%)
Mutual labels:  scrolling, scroll

Getting started

This package is providing you a Higher Order Component with a declarative API so you can detect if your users are scrolling in the browser or not. Apart from that you can also detect the direction of their scrolling like below.

npm i react-is-scrolling --save

import React, { Component } from 'react';
import IsScrolling from 'react-is-scrolling';

@IsScrolling
export default class YourComponent extends Component {
  render() {
    const { isScrolling, isScrollingDown, isScrollingUp } = this.props;
    
    return (
      <div>
        { isScrolling &&
          <p>You are scrolling</p>
        }
        
        { isScrollingDown &&
          <p>You are scrolling down</p>
        }
        
        { isScrollingUp &&
          <p>You are scrolling up</p>
        }
      </div>
    );
  }
}

Notice that this package is not using an imperative event based system like other packages so it is much more aligned with React's declarative nature. Also it abstracts away all the heavy lifting of debouncing browser's scroll event and is intended to support different browsers.

If you are not using ES7 decorator functions like @IsScrolling or you want to have this package on a stateless/function component, you can simply use it this way:

import React, { Component } from 'react';
import IsScrolling from 'react-is-scrolling';

function YourComponent({isScrolling, isScrollingDown, isScrollingUp}) {
  return (
    <div>
      { isScrolling &&
        <p>You are scrolling</p>
      }

      { isScrollingDown &&
        <p>You are scrolling down</p>
      }

      { isScrollingUp &&
        <p>You are scrolling up</p>
      }
    </div>
  );
}

export default IsScrolling(YourComponent);

Demo

You can check out how it works here

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].