JSFiddle - React, Tailwind, and code Playground
by zachleat
HTML
<div id="test"></div>
<button>Resize</button>
Event will only fire in IE.
CSS
#test {
width: 400px;
height: 200px;
border: 1px solid #000;
}
JavaScript
var t = document.getElementById('test'),
toggle = false;
$('button').bind('click', function()
{
$(t).width((toggle = !toggle) ? 200 : 400);
});
// Internet Explorer only demo.
// This only works with attachEvent (even in IE9).
// If you use addEventListener, resize only fires on the window (even in IE9).
// Think http://benalman.com/projects/jquery-resize-plugin/
if(window.attachEvent) {
test.attachEvent('onresize', function() {
alert('resize');
})
}