jQuery resize() example
Published: May 25, 2010 , Updated: May 14, 2010 , Author: mkyong
jQuery resize() event is fire when the size of the browser is changed, and this event is only bind to $(window).
$(window).resize(function () {
$('#msg').text('Browser (Width : ' + $(window).width()
+ ' , Height :' + $(window).height() + ' )');
});To get the browser’s width and height details, use $(window).width() and $(window).height().
Try it yourself
<html> <head> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <style type="text/css"> #browserInfo{ padding:8px; border:1px solid blue; width:300px; } </style> </head> <body> <h1>jQuery resize() example</h1> <h4>Try resize this browser</h4> <div id="browserInfo"> </div> <script type="text/javascript"> $('#browserInfo').text('Browser (Width : ' + $(window).width() + ' , Height :' + $(window).height() + ' )'); $(window).resize(function () { $('#browserInfo').text('Browser (Width : ' + $(window).width() + ' , Height :' + $(window).height() + ' )'); }); </script> </body> </html>
Any Java questions or problems? please post at this JavaNullPointer.com forum, see you there ~
[ Read More ] You can find more similar articles at jQuery Tutorials