Skip to content

Watches elements for changes in properties and attributes

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

ranma2913/cssWatch.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#cssWatch.js This is a fork from darcyclarke's Watch.js project. Please see: https://github.com/darcyclarke/Watch.js for full details.

This plugin lets you listen for when a CSS property, or properties, changes on element. It utilizes Mutation Observers to mimic the DOMAttrModified (Mutation Events API) and propertychange (Internet Explorer) events.

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

jQuery Usage

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

Default Usage

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

Bower Usage

bower install ranma2913/cssWatch.js --save

Dependancies

This library utilizes the Polymer team's Mutation Observers and WeakMap Polyfills. They are included by default which bulks the library a bit. Depending on future usage, I may choose to references these as bower dependancies.

License

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

About

Watches elements for changes in properties and attributes

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

Languages

  • JavaScript 100.0%