window.resize in jQuery firing multiple times

Viewed 27726

I have the following JavaScript/jQuery code in an HTML file:

<html>
  <head>
    <script src="http://code.jquery.com/jquery-1.6.2.min.js" 
     type="text/javascript"></script>
    <script language="javascript">
    $(window).resize(function(){alert('hi');});</script>
  </head>
  <body>
    resize me
  </body>
</html>

It appears relatively straightforward, however when I resize the browser window, I get two successive alert windows on Chrome and IE9 and I seemingly crash Firefox5.

What am I missing? Is it one fire per dimension (x/y)?

4 Answers
Related