Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 515
Iter Ator Avatar asked Sep 30 '14 08:09

Iter Ator


1 Answers

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>
like image 170
Ed Would Avatar answered Oct 13 '22 12:10

Ed Would