An easy to use plugin that monitors/observes the insertion and deletion of children in a parent element. Great for monitoring the size of a container.
This plugin uses MutationObserver API to monitor changes in a DOM
Supported browsers
Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|
18 -webkit | 14 (14) | 11 | 15 | 6.0 -webkit |
26 |
<script src="nmutation.js"></script>
nmutation.init(target, callback(parent, added, removed));
target can be a string or an array: i.e '.container'
or ['.container', '.your-container']
callback is a function
- parent is the affected or the parent DOM
- added added to parent DOM - default = [ ] empty array
- removed removed from parent DOM - default = [ ] empty array
nmutation.init('div.first', function(parent, added, removed) {
//Do something awesome...
});
or
nmutation.init(['div.first', 'div.second'], function(parent, added, removed) {
//Do something awesome...
});