In case you cannot use mediaqueries as everyone mention (for example if you need to support IE8), you could try something like this:
$(document).ready(function() {
function adjustStyle(width) {
width = parseInt(width);
if (width < 480) {
$("body").removeClass("c800 c600");
$("body").addClass("c400");
} else if ((width >= 481) && (width < 600)) {
$("body").removeClass("c400 c800");
$("body").addClass("c600");
} else if ((width >= 601) && (width < 800)) {
$("body").removeClass("c400 c600");
$("body").addClass("c800");
} else {
$("body").removeClass("c800 c400 c600");
}
}
$(function() {
adjustStyle($(this).width());
$(window).resize(function() {
adjustStyle($(this).width());
});
});
});
Instead of load different stylesheets, this code add a class in the body
tag, and then you can create 'fake' mediaqueries:
.container {width:900px}
.c800 .container {width:700px;}
.c600 .container {width:500px;}