Skip to content

Instantly share code, notes, and snippets.

@Godoy
Forked from tiagobbraga/gist:5110874
Last active December 14, 2015 15:49
Show Gist options
  • Save Godoy/5110936 to your computer and use it in GitHub Desktop.
Save Godoy/5110936 to your computer and use it in GitHub Desktop.
Observando alterações de DOM em uma div
setTimeout
(
StartWatching,
100
);
function StartWatching()
{
$("#someDiv").bind('DOMSubtreeModified',function() {
alert('modificou');
StopWatchingAndStartAgainLater();
});
}
function StopWatching()
{
$("#someDiv").unbind('DOMSubtreeModified');
}
function StopWatchingAndStartAgainLater()
{
StopWatching();
setTimeout
(
StartWatching,
100
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment