forked from weblinc/media-match
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
29 lines (28 loc) · 1.05 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="media.match.min.js"></script>
</head>
<body>
<script type="text/javascript">
var mql = window.matchMedia('screen and (color) and (orientation: landscape) and (min-width: 600px) and (min-height: 400px)');
//console.log(mql);
/*
mql has the following properties:
matches : <Boolean>
media : <String>
addListener : <Function>
removeListener : <Function>
*/
window.matchMedia('screen and (min-width: 600px) and (min-height: 400px), screen and (min-height: 400px)')
.addListener(function(mql) {
if (mql.matches) {
// Media query does match
} else {
// Media query does not match anymore
}
});
</script>
</body>
</html>