jQuery: Different layouts for different widths
Article by Jeffery Way on Net.tuts+
“It’s becoming more and more common for web sites and applications to provide different layouts dependent upon the user’s window size, or resolution. This can be accomplished in a variety of ways, ranging from CSS to JavaScript solutions. In this video quick tip, we’ll learn how laughably simple it is to do this with a touch of jQuery, and the resize() method.”
=============================================================
function checkWindowSize() {
if ( $(window).width() > 1800 ) {
$(‘body’).addClass(‘large’);
} else {
$(‘body’).removeClass(‘large’);
}
}
$(window).resize(checkWindowSize);
=============================================================
Tags: CSS, HTML, Javascript, Tutorials
Posted on Tuesday, February 16th, 2010 at 12:16 pm.
Online Article, Tutorials, Web Authoring.