Hey guys, how are you all doing? I am stuck with my media query which is used to change to a handheld stylesheet. The problem is that it actually works, but before it loads the mobile version of the website its loads the main version designed for desktop computers, THEN it loads the mobile version! It's like the most contradictive thing ever, it is suppossed to save bandwidth for mobile users, it is instead increasing the bandwidth, I have no idea why it is doing this, I have messed around for a couple of days with my iphone and the Opera emulator and I just cant figure out whats going on.
I was thinking that I have an images gallery page and this is the worst to load, in the small device css the divs that contain the images are set display:none; and the div that holds all these divs is also set to display: none; but the still load up. If anyone has any ideas, or can point out the problem, that would be grand because I am completely and totally stumped and I only have a few days to complete the website.
Here is the code I have in the header of every HTML file:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="Topic one page two of Dundee city website" />
<meta name="keywords" content="Dundee, mills, observatory, page two" />
<meta name="language" content="en"/>
<meta name="viewport" content="width=480 />
<title>Page Seven</title>
<link rel="stylesheet" href="smallDev.css" type="text/css" media="handheld" />
<!--[if IE]> <link rel="STYLESHEET" type="text/css" href="master.css" title="Normal browsers"/> <![endif]-->
<link rel='stylesheet' media='screen and (min-width: 481px)' href='master.css' />
<script type="text/javascript" src="myscript.js">
//<![CDATA[
{
// some code
}
//]]>
</script>
</head>
Here is the javascript I am using to check the screen width:
/* function to include style sheet for smaller devices */
window.onload = function()
{
if (screen.width < 481)
{
var url="smallDev.css";
var link = document.createElement('link');
link.setAttribute('rel','stylesheet');
link.setAttribute('type','text/css');
link.setAttribute('href',url);
document.getElementsByTagName('head')[0].appendChild(link);
}
}
Is perhaps the problem that I have 28 images in the image gallery HTML at 400 x 400 each, when perhaps I should have all these images in the CSS?? I dont know if you can have images in CSS instead of in the HTML, but all I know is that I thought it was semantic to have images in the HTML and ok to do this.
Once again, any input, help from you guys is appreciated fully!!
Cheers!!!!