JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://meetselva.github.io/attrchange/javascripts/attrchange.js"></script>
<div id="test"></div>
CSS
#test {
border: 1px solid red;
width: 100px;
height: 100px;
}
JavaScript
$(function () {
var prevWidth = $('#test').width(),
prevHeight = $('#test').height();
$('#test').attrchange({
callback: function (e) {
var curWidth = $(this).width(),
curHeight = $(this).height();
if (prevWidth !== curWidth ||
prevHeight !== curHeight) {
console.log('resized: width - ' + prevWidth + ' : ' + curWidth + ' height - ' + prevHeight + ' : ' + curHeight);
prevWidth = curWidth;
prevHeight = curHeight;
}
}
}).resizable();
});