This repository has been archived by the owner on Jan 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
/
index.html
128 lines (109 loc) · 2.79 KB
/
index.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<!-- META -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- tell mobile browsers to scale -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jRespond Test Page</title>
<!-- css -->
<style>
body {
background-color: #fff;
margin: 0;
}
#output {
font-size: 24px;
margin: 100px 0;
text-align: center;
}
</style>
</head>
<body>
<div class="wrapper">
<p id="output"></p>
</div>
<!-- Javascript -->
<script src="js/util.js"></script>
<script src="js/jRespond.js"></script>
<script>
// call jRespond and add breakpoints
var jRes = jRespond([
{
label: 'handheld',
enter: 0,
exit: 767
},{
label: 'tablet',
enter: 768,
exit: 979
},{
label: 'laptop',
enter: 980,
exit: 1199
},{
label: 'desktop',
enter: 1200,
exit: 10000
}
]);
// usage
var outputStr = document.getElementById('output');
jRes.addFunc({
breakpoint: 'desktop',
enter: function() {
console.log('>>> run this for the DESKTOP breakpoint <<<');
outputStr.innerHTML = 'Current breakpoint: desktop';
},
exit: function() {
console.log('<<< destroy this when exiting the DESKTOP breakpoint >>>');
}
});
jRes.addFunc({
breakpoint: ['laptop','tablet'],
enter: function() {
console.log('>>> run this for the LAPTOP/TABLET breakpoint <<<');
},
exit: function() {
console.log('<<< destroy this when exiting the LAPTOP/TABLET breakpoint >>>');
}
});
jRes.addFunc({
breakpoint: 'laptop',
enter: function() {
outputStr.innerHTML = 'Current breakpoint: laptop';
}
});
jRes.addFunc({
breakpoint: 'tablet',
enter: function() {
outputStr.innerHTML = 'Current breakpoint: tablet';
}
});
jRes.addFunc({
breakpoint: 'handheld',
enter: function() {
console.log('>>> run this for the HANDHELD breakpoint <<<');
outputStr.innerHTML = 'Current breakpoint: handheld';
},
exit: function() {
console.log('<<< destroy this when exiting the HANDHELD breakpoint >>>');
}
});
jRes.addFunc({
breakpoint: '*',
enter: function() {
console.log('>>> run this when entering EVERY breakpoint <<<');
},
exit: function() {
console.log('<<< run this when exiting EVERY breakpoint >>>');
}
});
</script>
</body>
</html>