Been trying to apply a javascript that will change the Css href if the browser window or device is a different size. I have scoured here and tested all of them with no results. here is my code so far. AND YES I TRIED MEDIA QUERIES AND THEY DON'T WORK
media queries i tried to use:
<link rel="stylesheet" type="text/css" media="screen and (min-width: 900px)" href="css/main.css" />
<link rel="stylesheet" type="text/css" media="screen and (min-width: 701px) and (max-width: 899px)" href="css/medium.css" />
<link rel="stylesheet" type="text/css" media="screen and (max-width: 700px)" href="css/narrow.css" />
the css links:
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link id="size-stylesheet" rel="stylesheet" type="text/css" href="wide.css" />
the entire javascript:
<script type="text/javascript" >
function changeImage(a) {
document.getElementById("img").src=a;
}
function adjustStyle(width) {
width = parseInt(width);
if (width < 701) {
$("#size-stylesheet").attr("href", "css/narrow.css");
} else if ((width >= 701) && (width < 900)) {
$("#size-stylesheet").attr("href", "css/medium.css");
} else {
$("#size-stylesheet").attr("href", "css/wide.css");
}
}
$(function() {
adjustStyle($(this).width());
$(window).resize(function() {
adjustStyle($(this).width());
});
});
</script>