I'm trying to use the following code to improve a couple of layout elements on an adaptive design. It doesn't seem to work though, it calls the first property, but that's it. Here it is in testing state using color.
$(document).ready(function() {
if ((screen.width>940)) {
// if screen size is 940px wide or larger
$("body").css('color', '#222'); // you can also use $(".yourClass").hide();
} else {
// if screen size width is less than 940px
$("body").css('color', 'red'); // here you can also use show();
}
});
Any help is sincerely appreciated!
ifstatement with$(window).resize(function() { /* code here */ }).resize();.