$(window).resize(function() { ... });
$(document).ready(function() { /* your code */ });
让事情发生在onload上.如果你想要一些工作onload和onresize,你应该做:
onResize = function() { /* your code */ } $(document).ready(onResize); $(window).bind('resize',onResize);