Permalink
Browse files

add back examples.

  • Loading branch information...
1 parent b69daf6 commit 154509a61d6373fec62477cb07dd9bb8d03da5a8 @paulirish committed Apr 1, 2011
Showing with 24 additions and 2 deletions.
  1. +24 −2 matchMedia.js
View
@@ -13,7 +13,7 @@
if ( !(window.matchMedia) ){
- window.matchMedia = (function(doc,undefined){
+ window.matchMedia = (function(doc, undefined){
var bool,
docElem = doc.documentElement,
@@ -46,4 +46,26 @@ if ( !(window.matchMedia) ){
})(document);
-}
+}
+
+
+
+/*
+ * EXAMPLE USAGE
+ */
+
+//test 'tv' media type
+if (matchMedia('tv').matches) {
+ // tv media type supported
+}
+
+//test a mobile device media query
+if (matchMedia('screen and (max-width: 480px)').matches) {
+ // smartphone/iphone... maybe run some small-screen related dom scripting?
+}
+
+//test landscape orientation
+if (matchMedia('(orientation:landscape)').matches) {
+ // probably tablet in widescreen view
+}
+

0 comments on commit 154509a

Please sign in to comment.