Skip to content

React when a element is in the view port and when it leaves.

Notifications You must be signed in to change notification settings

will-ashworth/jQueryIsInViewport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQueryIsInViewport

This plugin allows you to react when an element is in the viewport. You need throw confetti when the user scroll and see an element?, so this plugin is for you!

Install

npm install jquery-is-in-viewport --save
// or
yarn add jquery-is-in-viewport
// or 
bower install jquery-is-in-viewport

Usage

$('.block').isInViewport(function (status) {
  if (status === 'entered') {
    $(this).addClass('throw-confetti')
  }

  if (status === 'leaved') {
    $(this).removeClass('throw-confetti')
  }
})

Options

Status can be 'entered' or 'leaved'.

About

React when a element is in the view port and when it leaves.

Resources

Stars

Watchers

Forks

Packages

No packages published