Skip to content

Watches elements for changes in the attributes defined and executes callback

License

GPL-2.0, MIT licenses found

Licenses found

GPL-2.0
LICENSE-GPL
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

wickcreative/jQuery-Watch-Plugin

 
 

Repository files navigation

#Watch Plugin

This plugin lets you listen for when a CSS property, or properties, changes on element. It utilizes Mutation Observers or the DOMAttrModified / propertychange events, when available, and fallsback to polling utilizing setInterval().

There is both a jQuery-specific plugin as well as a library agnostic version of this plugin available.

Original blog post can be found here

Example Uses

More examples can be found here

jQuery Usage

// Watch for width or height changes and log values
$('div').watch('width height', function(){
	console.log(this.style.width, this.style.height);
});

Library Agnostic Usage

// Watch for width or height changes and log values
var div = document.querySelectorAll('div');
watch( div, 'width height', function(){
	console.log(this.style.width, this.style.height);
});

License

Copyright (c) 2013 Darcy Clarke
Dual licensed under the MIT and GPL licenses.

About

Watches elements for changes in the attributes defined and executes callback

Resources

License

GPL-2.0, MIT licenses found

Licenses found

GPL-2.0
LICENSE-GPL
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published