I know I can let one element resize through css3 resize property:
resize: both;
overflow: auto
but can I catch the resize event? like:
element.addEventListener('resize', fn, false);
I try this, but it doesn't work, is there other way to do this kind of job?
As per this answer, you may try:
var addEvent = function(elem, type, eventHandle) {
if (elem == null || elem == undefined) return;
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
} else {
elem["on"+type]=eventHandle;
}
};
Called:
addEvent(element, 'resize', fn); // you may want to try 'onresize'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With