Change div width live with jQuery
问题 Is it possible to change a div 's width live with jQuery? And if it is, how? What I want is to change its width depending on the browser's window width in real time, so if/when the user changes the browser window, the div 's dimensions are changed as well in realtime. 回答1: You can use, which will be triggered when the window resizes. $( window ).bind("resize", function(){ // Change the width of the div $("#yourdiv").width( 600 ); }); If you want a DIV width as percentage of the screen, just