I need you because I need to detect if a div is resizing and I just found some solution using JQuery and window.resize.
The thing is that I don't want to use any library, and the window is not resizing. The div is resizing because a menu pop up. I could do that with a dispatch event on the menu, but I want my widget to work itself.
JS FIDDLE : http://jsfiddle.net/b7mNU/3/
I want to get the onresize of the red rectangle without using the event on the menu (yellow div). Something like :
child.addEventListener('resize', function(){ /* do something */ }, false);
The height and width of the element to be tracked is found out using the height() and width() method in jQuery.
The resize event fires when the document view (window) has been resized. This event is not cancelable and does not bubble. In some earlier browsers it was possible to register resize event handlers on any HTML element.
These is no such event for <div>
elements. You could however use an interval function to watch the state of it's style.width
and style.height
. If that changes fire a callback.
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