Note: Aside from adding AJAX in 2005,
JavaScript hasn't changed
browsername=navigator.appName;
if (browsername.indexOf("Netscape")!=-1) {browsername="NS"}
else if (browsername.indexOf("Microsoft")!=-1) {browsername="MSIE"}
browserversion="0";
if (navigator.appVersion.indexOf("2.")!=-1){browserversion="2"};
if (navigator.appVersion.indexOf("3.")!=-1){browserversion="3"};
//Load current temperature from an external webservice //by passing a zipcode...all without reloading the page
$.ajax({url: "/api/getWeather", data: {zipcode: 90210}, success: function( data ) { $( "#temp" ).html(data + " degrees" ); } });
Laptop and Desktop ownership is the
same today as it was in 2007
li:nth-child(even) {
color: white;
background-color: black;
}
<!-- In your HTML --> <link media=”(min-width: 480px)” ... <link media=”screen and (max-width: 1024px)” ...
/* In your CSS */ @media (min-width: 480px) { ... } @media screen and (max-width: 1024px) { ... }
<!-- html --> <meta name="viewport" content="width=device-width; initial-scale=1.0;">
/* CSS */ @-webkit-viewport { width:device-width; } @-moz-viewport { width:device-width; } @-ms-viewport { width:device-width; } @-o-viewport { width:device-width; } @viewport { width:device-width; }
/* Fixed */ .container{ width: 600px; } .sidebar{ width: 200px; }
/* Responsive */ .container{ width: 100%; } .sidebar{ width: 33.33333%} /* 200 / 600 = 33.33333*/
/* styles.css */ aside { color: #333; width: 100%; }
/* if the viewport width is 40em or greater */ @media (min-width: 40em) { aside { width: 50%; } }
/* if the viewport width is 60em or greater */ @media (min-width: 60em) { aside { width: 30%; } }
<link href=”global.css” rel=”stylesheet”>
<link href=”layout.css” media=”(min-width: 40em)” rel=”stylesheet”>
<!--[if (lt IE 9) & (!IEMobile)]> <link href=”layout.css” rel=”stylesheet”> <![endif]-->
<link href=”base.css” rel=”stylesheet”>
<!--[if (lt IE 9) & (!IEMobile)]> <link href=”no-mq.css” rel=”stylesheet”> <![endif]-->
base.scss /* Sass */ @import “smallest”; @media (min-width: 40em) { @import “40em”; } @media (min-width: 60em) { @import “60em”; }
no-mq.scss @import “40em”; @import “60em”;