How can I run a JavaScript function every time an HTML element is resized?
问题 I need to run a script every time a table is resized (whenever the user resizes the browser window). Does anyone know how this can be done? 回答1: function myFunction() { alert('resized'); } window.onresize = myFunction; 回答2: window.onresize = function(){alert('test');} 回答3: If you use Jquery, $(window).resize(function() { alert("test now"); }); 来源: https://stackoverflow.com/questions/2733533/how-can-i-run-a-javascript-function-every-time-an-html-element-is-resized