Skip to content
A JavaScript library with no dependencies which allows us to quickly check if an element is within the browsers visual viewport regardless of the window scroll position.
JavaScript
Find file
Pull request Compare This branch is 5 commits ahead, 2 commits behind customd:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dist
src
tests
.gitignore
.jshintrc
.travis.yml
LICENSE
README.md
bower.json
karma.config.js
package.json
webpack.config.js

README.md

visible.js Build Status

Simple library with no dependencies to check if an element is visible on the current viewport.

Install

bower install visible.js

Usage

visible(document.getElementById('my-elem')); // Returns true if the element is visible!

visible(document.getElementById('my-elem'), true); // Returns true if the element is partially or completely visible!

visible(document.getElementById('my-elem'), false, true); // Returns true if the element is visible even if it's hidden!

visible(document.getElementById('my-elem'), false, false, 'vertical'); // Returns true if the element is visible vertically!

visible(document.getElementById('my-elem'), false, false, 'vertical'); // Returns true if the element is visible horizontally!

Blog article

Limitations

Currently, this plugin will not check for visibility in nested scrollable areas, only on the main viewport (window object).

Disclaimer

Based on customd jquery.visible https://github.com/customd/jquery-visible

Something went wrong with that request. Please try again.