Iter Ator
Iter Ator

Reputation: 9289

How to call a function on div resize?

There is a new CSS property, called resize, so the divs are resizeable too. But how to attach an event listener? Because .onresize works only on the window object

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


Edit:

I don't want to use JQuery. It's not a duplicate question. I've found only JQuery solutions for this problem, that's why I asked this question.

Upvotes: 7

Views: 1907

Answers (1)

Ed Would
Ed Would

Reputation: 38

I worked around it this way. Seems to work OK in Firefox at least. It fires when you take your cursor off the resize 'grabber' on the bottom right of the element you're resizing.

<DOCTYPE=html>
<html>

<script>
function functionname()
{
//replace this line with the script you want executed
}
</script>

<style>
#idname {resize:both;}
</style>

<body>
<div id="idname" onmouseout="functionname();"></div>
</body>

</html>

Upvotes: 2

Related Questions