All Projects β†’ miguelmota β†’ inview

miguelmota / inview

Licence: MIT License
Detect when element scrolled to view

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to inview

linearmouse
πŸ–± The mouse and trackpad utility for Mac.
Stars: ✭ 1,151 (+3188.57%)
Mutual labels:  scrolling
momentum
Track movement and basic events with CSS custom properties
Stars: ✭ 19 (-45.71%)
Mutual labels:  scrolling
Scrolling-techniques-using-Android-Design-Support-Library
Como aplicar as tΓ©cnicas de rolagem do Material Design usando a biblioteca de suporte Android Design Support Library
Stars: ✭ 21 (-40%)
Mutual labels:  scrolling
react-list-any-height
React scroll list for item with any height
Stars: ✭ 12 (-65.71%)
Mutual labels:  scrolling
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (-31.43%)
Mutual labels:  scrolling
mousecase
A JavaScript utility enabling horizontal dragging on mousedown events πŸ–±
Stars: ✭ 35 (+0%)
Mutual labels:  scrolling
really-smooth-scroll
A script that smoothen scrolling in the browser
Stars: ✭ 21 (-40%)
Mutual labels:  scrolling
ng-scrollable
Superamazing scrollbars for AngularJS
Stars: ✭ 58 (+65.71%)
Mutual labels:  scrolling
react-sticky-headroom
A React Component to hide a Header using CSS sticky position
Stars: ✭ 22 (-37.14%)
Mutual labels:  scrolling
EmbeddedScrollView
Embedded UIScrollView for iOS.
Stars: ✭ 55 (+57.14%)
Mutual labels:  scrolling
clever-infinite-scroll
A useful infinite scroll jQuery plugin. It changes title and URL automatically, it's nice for SEO.
Stars: ✭ 56 (+60%)
Mutual labels:  scrolling
react-native-infinite-scroll
A simple implementation of infinite scrolling for React Native.
Stars: ✭ 19 (-45.71%)
Mutual labels:  scrolling
SlideUpTopBar-for-Foundation
SlideUpTopBar is an extension for the Zurb Foundation 5 top-bar component. It hides the top-bar when scrolling down a page & shows it when scrolling back up the page.
Stars: ✭ 47 (+34.29%)
Mutual labels:  scrolling
EasyScrollDots
Single page scroll JavaScript plugin that allows for vertical navigation of page sections
Stars: ✭ 38 (+8.57%)
Mutual labels:  scrolling
PenTerm
Terminal config for pentesters.
Stars: ✭ 20 (-42.86%)
Mutual labels:  scrolling
angular-scrollspy
A simple lightweight library for Angular which automatically updates links to indicate the currently active section in the viewport
Stars: ✭ 34 (-2.86%)
Mutual labels:  scrolling
infinite-viewer
Infinite Viewer is Document Viewer Component with infinite scrolling.
Stars: ✭ 85 (+142.86%)
Mutual labels:  scrolling
scrollparent.js
A function to get the scrolling parent of an html element.
Stars: ✭ 51 (+45.71%)
Mutual labels:  scrolling
volx-recyclerview-fast-scroll
An easy to use implementation for fast scroll recyclerview
Stars: ✭ 34 (-2.86%)
Mutual labels:  scrolling
react-picky-date-time
A react component for date time picker. Online demo examples
Stars: ✭ 41 (+17.14%)
Mutual labels:  scrolling


logo


inView

Detect when element scrolled to view

License Build Status dependencies Status NPM version

Demo

https://lab.miguelmota.com/inview/demo/

Install

npm install inview

Getting started

Basic example

var inview = InView(el, function(isInView) {
  if (isInView) {
    // do something
    // ...
  }
});

Example showing if visible top half or bottom half of screen

var inview = InView(el, function(isInView, data) {
  if (isInView) {
    if (data.elementOffsetTopInViewHeight < data.inViewHeight/2) {
      console.log('in view (top half)')
    } else {
      console.log('in view (bottom half)')
    }
  } else {
    if (data.windowScrollTop - (data.elementOffsetTop - data.inViewHeight) > data.inViewHeight) {
      console.log('not in view (scroll up)')
    } else {
      console.log('not in view (scroll down)')
    }
  }
})

Destroy InView listeners

var inview = InView(el, function(isInView, data) {
  if (isInView) {
    // do something
    // ...

    this.destroy()
  }
})

// another way
inview.destroy()

Documentation

Constructor:

  • InView(element, callback)

Scroll callback parameters:

  • {boolean} isInView - is in view
  • {object} data - scroll data
  • {number} data.windowScrollTop - scrolled amount
  • {number} data.elementOffsetTop - element top offset
  • {number} data.inViewHeight - height of visible area
  • {number} data.elementOffsetTopInViewHeight - element top offset relative to height of visible area

Visualization:

diagram

License

MIT

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].