How to call a function to fit the div?

There is a new CSS property called resize, so divs can also be resized. But how to connect an event listener? Since .onresize only works on a window object

JSFiddle: http://jsfiddle.net/3y0gfj8j/


Edit:

I do not want to use jQuery. This is not a duplicate question. I only found jQuery solutions for this problem, so I asked this question.

+7
javascript html css javascript-events
source share
1 answer

This is a real problem in today's DOM. Modern browsers support overflow / overflow events that can be used to detect resizing, while IE supports a non-standard resize event. The problem is that IE11 removed this non-standard event and did not provide any alternative, so you need to use hacks on hacks roughly. A working hack can be found here:

http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/

-one
source share

All Articles