Skip to content

bigteejay/true-visibility

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

true-visibility

Checks if a DOM element is able to be visible. This means that it could be viewable (but it's parent is scrolled such that you can't currently see it.) Essentially, with scrolling accounted for, could the element be entirely viewed within its parent.

Installation

    bower install git+https://github.com/bigteejay/true-visibility --save

Development

    git clone https://github.com/bigteejay/true-visibility
    cd true-visibility
    git config user.name {username}
    git config user.email {email}
    npm install
    gulp [default]

Usage

isVisible accepts elements and selector strings.

true-visibility is UMD compatible. Depending on your environment, you can use true-visibility as follows.

    requirejs( [ 'true-visibility' ], function( isVisible )
    {
        isVisible( 'body' ) // true
    } );

or

    let isVisible = require( 'true-visibility' );
    isVisible( 'body' ); // true

or

    var bodyElement = document.getElementById( 'body' );
    isVisible( bodyElement ); // true

Need to report something? [email protected]

Changes

  • 0.2.1

    • External sourcemaps
  • 0.2.0

    • Forked from https://github.com/mousemke/true-visibility
    • Significant rewrite to visibility detection method
    • Added bower (considering registering this package)
    • Build system revised to require running jshint first (successfully)
    • Now generates/includes sourcemap
    • Updated dist
    • Updated readme

About

Checks if a DOM element is viewable in its entirety (accounts for scrolling)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%