Javascript examples for DOM Event:onresize
Run object's function in window resize event
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//ww w . j a v a 2 s . co m function fan(top, left) { this.top = top; this.left = left; this.setPos = function setPos(x, y) { //some code console.log(x + " " + y) } } var fan2 = new fan(10, 10); fan2.setPos(20, 20); window.onresize = function resize() { fan2.setPos(30, 30); } } </script> </head> <body> </body> </html>