Index: pkg/polymer/lib/elements/polymer-media-query/demo.html |
diff --git a/pkg/polymer/lib/elements/polymer-media-query/demo.html b/pkg/polymer/lib/elements/polymer-media-query/demo.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3264f20b3f599d99826a18293dd48418fe783d05 |
--- /dev/null |
+++ b/pkg/polymer/lib/elements/polymer-media-query/demo.html |
@@ -0,0 +1,36 @@ |
+<!DOCTYPE html> |
+<html lang="en"> |
+<head> |
+ <meta charset="UTF-8"> |
+ <title>Polymer match media</title> |
+ <script src="../platform/platform.js"></script> |
+ <link rel="import" href="polymer-media-query.html" /> |
+</head> |
+<body> |
+ |
+ <polymer-element name="match-example"> |
+ <template> |
+ <polymer-media-query query="{{query}}" queryMatches="{{qMatches}}"></polymer-media-query> |
+ My query of "{{query}}" {{qMatches ? "matches" : "doesn't match"}} |
+ </template> |
+ <script> |
+ Polymer('match-example', { |
+ query: 'min-width: 600px' |
+ }); |
+ </script> |
+ </polymer-element> |
+ |
+ <match-example id="me"></match-example> |
+ <pre id="output"> |
+ Log of 'mediachange' events on document, from polymer-match-media: |
+ </pre> |
+ |
+ <script> |
+ var output = document.querySelector('#output'); |
+ // on-mediachange would give true or false as second param to the handler |
+ document.addEventListener('polymer-mediachange', function(e) { |
+ output.textContent += '\nevent: ' + e.type + ' query: ' + e.detail.media + ' matches: ' + e.detail.matches; |
+ }); |
+ </script> |
+</body> |
+</html> |