Skip to content

iprodev/jquery.visibilityState

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jquery.visibilityState

Executes a callback when an element's visibility changes

Example: https://iprodev.github.io/jquery.visibilityState/

// Using plugin mode
$("#tester").visibilityState(function(isVisible) {
    if (isVisible) {
        // do something here when element visibled.
    } else {
        // do something here when element hidden.
    }
});

// Using event mode
$("#tester").on('visible', function() {
    // do something here when element visibled.
});
$("#tester").on('hidden', function() {
    // do something here when element hidden.
});