Skip to content

joneschrisan/jquery.visibilityChanged

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

jquery.visibilityChanged

Executes a callback when an element's visibility changes

##Example

$("#tester").visibilityChanged({
    changed: function(element, currentVisibility, previousVisibility, event) {
       // Do something here
    },
    same: function(element, visibility, event) {
        // Do something here
    },
    eventList: [ 'click', 'mouseMove', 'keyUp', 'scroll', 'resize' ]
});

##Default options

changed: function (element, currentVisibility, previousVisibility, event) {},
same: function(element, visibility, event) {},
eventList: [
	'click',
	'mouseMove',
	'keyUp',
	'scroll',
	'resize'
]

##Run on page load

To run onpage load simply add the 'watchVisibility' class to the element you want to watch.

<div class="watchVisibility"></div>

To set the options for that element use attribute

<div data-visibility-changed-options='{"optionName": "optionValue"...}'></div>

Note the ' and " are important for jQuery to be able to read the attribute value as an object.

About

Executes a callback when an element's visibility changes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%