$(window).resize(function()
javascript中(function()….)isclassicjQuery,isequalto(document).ready(function() {….}). That means this function will be executed after the html is loaded. This way is safer to deal with DOM after page is loaded.
(document).ready(function())==(function(){});
$(window).resize(function()
<script>
x=0;
$(document).ready(function(){
$(window).resize(function(){
$("span").text(x+=1);
});
});
</script>
http://www.runoob.com/try/try.php?filename=tryjquery_event_resize