JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://techfoobar.com/jquery-style-listener/stylelistener.jquery.min.js"></script>
<button id="btnHide">Hide It</button>
<button id="btnShow">Show It</button>
<hr>
<div id="foo">Hello World</div>
JavaScript
$('#foo').styleListener({
// the styles that you want to monitor for changes
styles: ['display'],
// function to be called when a monitored style changes
changed: function(style, newValue, oldValue, element) {
alert(style + ' changed from ' + oldValue + ' to ' + newValue);
}
});
$('#btnHide').click(function() {
$('#foo').hide();
});
$('#btnShow').click(function() {
$('#foo').show();
});