Run object's function in window resize event - Javascript DOM Event

Javascript examples for DOM Event:onresize

Description

Run object's function in window resize event

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials