latest h5bp changes: placeholder media queries for mobile-first approach and addition of respond.js

This commit is contained in:
Ben Word
2011-05-08 17:17:26 -06:00
parent ec4ec025be
commit 985ba6f240
3 changed files with 16 additions and 13 deletions

View File

@@ -1,10 +1,10 @@
/* GENERAL /* GENERAL
--------------------------------------------------------------------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* Typography */ /* Typography */
html { overflow-y: scroll; } html { overflow-y: scroll; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; }
body { background: #fff; font-family: sans-serif; } body { background: #fff; font-family: sans-serif; }
a { color: #06c; } a { color: #06c; -webkit-tap-highlight-color: #06c; }
a:hover, a:focus { color:#09f; } a:hover, a:focus { color:#09f; }
a:hover, a:active { outline: none; } a:hover, a:active { outline: none; }
a:active, input.button:active { outline: 0; position: relative; top: 1px; } a:active, input.button:active { outline: 0; position: relative; top: 1px; }
@@ -408,20 +408,15 @@ img.ui-datepicker-trigger { vertical-align: middle; }
/* MEDIA QUERIES /* MEDIA QUERIES
--------------------------------------------------------------------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------------------------------------------------------------------- */
@media all and (orientation: portrait) { @media only screen and (min-width: 480px) {
/* Style adjustments for portrait mode goes here */ /* Style adjustments for viewports 480px and over go here */
} }/*/mediaquery*/
@media all and (orientation: landscape) { @media only screen and (min-width: 768px) {
/* Style adjustments for landscape mode goes here */ /* Style adjustments for viewports 768px and over go here */
} }/*/mediaquery*/
@media screen and (max-device-width: 480px) {
/* Grade-A Mobile Browsers (Opera Mobile, iPhone Safari, Android Chrome) */
}
@media print { @media print {
* { background: transparent !important; color: black !important; text-shadow: none !important; filter: none !important; -ms-filter: none !important; } * { background: transparent !important; color: black !important; text-shadow: none !important; filter: none !important; -ms-filter: none !important; }

View File

@@ -15,6 +15,7 @@
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> Feed" href="<?php echo home_url(); ?>/feed/"> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> Feed" href="<?php echo home_url(); ?>/feed/">
<script src="<?php echo get_template_directory_uri(); ?>/js/libs/modernizr-1.7.min.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/js/libs/modernizr-1.7.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/libs/respond.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script>window.jQuery || document.write("<script src='<?php echo get_template_directory_uri(); ?>/js/libs/jquery-1.6.min.js'>\x3C/script>")</script> <script>window.jQuery || document.write("<script src='<?php echo get_template_directory_uri(); ?>/js/libs/jquery-1.6.min.js'>\x3C/script>")</script>

7
js/libs/respond.min.js vendored Normal file
View File

@@ -0,0 +1,7 @@
/*
* respond.js - A small and fast polyfill for min/max-width CSS3 Media Queries
* Copyright 2011, Scott Jehl, scottjehl.com
* Dual licensed under the MIT or GPL Version 2 licenses.
* Usage: Check out the readme file or github.com/scottjehl/respond
*/
(function(e,h){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=h;if(h){return}var u=e.document,r=u.documentElement,i=[],k=[],p=[],o={},g=30,f=u.getElementsByTagName("head")[0]||r,b=f.getElementsByTagName("link"),d=[],a=function(){var B=b,w=B.length;for(var z=0;z<w;z++){var y=B[z],x=y.href,A=y.media,v=y.rel&&y.rel.toLowerCase()==="stylesheet";if(!!x&&v&&!o[x]){if(!/^([a-zA-Z]+?:(\/\/)?(www\.)?)/.test(x)||x.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:x,media:A})}else{o[x]=true}}}t()},t=function(){if(d.length){var v=d.shift();n(v.href,function(w){m(w,v.href,v.media);o[v.href]=true;t()})}},m=function(G,v,x){var E=G.match(/@media ([^\{]+)\{((?!@media)[\s\S])*(?=\}[\s]*\/\*\/mediaquery\*\/)/gmi),H=E&&E.length||0,v=v.substring(0,v.lastIndexOf("/")),w=function(I){return I.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+v+"$2$3")},y=!H&&x;if(v.length){v+="/"}if(y){H=1}for(var B=0;B<H;B++){var C;if(y){C=x;k.push(w(G))}else{C=E[B].match(/@media ([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&w(RegExp.$2))}var z=C.split(","),F=z.length;for(var A=0;A<F;A++){var D=z[A];i.push({media:D.match(/(only\s+)?([a-zA-Z]+)(\sand)?/)&&RegExp.$2,rules:k.length-1,minw:D.match(/\(min\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1),maxw:D.match(/\(max\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1)})}}j()},l,q,j=function(E){var v="clientWidth",x=r[v],D=u.compatMode==="CSS1Compat"&&x||u.body[v]||x,z={},C=u.createDocumentFragment(),B=b[b.length-1],w=(new Date()).getTime();if(E&&l&&w-l<g){clearTimeout(q);q=setTimeout(j,g);return}else{l=w}for(var y in i){var F=i[y];if(!F.minw&&!F.maxw||(!F.minw||F.minw&&D>=F.minw)&&(!F.maxw||F.maxw&&D<=F.maxw)){if(!z[F.media]){z[F.media]=[]}z[F.media].push(k[F.rules])}}for(var y in p){if(p[y]&&p[y].parentNode===f){f.removeChild(p[y])}}for(var y in z){var G=u.createElement("style"),A=z[y].join("\n");G.type="text/css";G.media=y;if(G.styleSheet){G.styleSheet.cssText=A}else{G.appendChild(u.createTextNode(A))}C.appendChild(G);p.push(G)}f.insertBefore(C,B.nextSibling)},n=function(v,x){var w=c();if(!w){return}w.open("GET",v,true);w.onreadystatechange=function(){if(w.readyState!=4||w.status!=200&&w.status!=304){return}x(w.responseText)};if(w.readyState==4){return}w.send()},c=(function(){var v=false,w=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new XMLHttpRequest()}],y=w.length;while(y--){try{v=w[y]()}catch(x){continue}break}return function(){return v}})();a();respond.update=a;function s(){j(true)}if(e.addEventListener){e.addEventListener("resize",s,false)}else{if(e.attachEvent){e.attachEvent("onresize",s)}}})(this,(function(f){if(f.matchMedia){return true}var e,i=document,c=i.documentElement,g=c.firstElementChild||c.firstChild,h=!i.body,d=i.body||i.createElement("body"),b=i.createElement("div"),a="only all";b.id="mq-test-1";b.style.cssText="position:absolute;top:-99em";d.appendChild(b);b.innerHTML='_<style media="'+a+'"> #mq-test-1 { width: 9px; }</style>';if(h){c.insertBefore(d,g)}b.removeChild(b.firstChild);e=b.offsetWidth==9;if(h){c.removeChild(d)}else{d.removeChild(b)}return e})(this));