forked from sdvig/zAccordion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponsive.html
More file actions
executable file
·168 lines (154 loc) · 5.46 KB
/
responsive.html
File metadata and controls
executable file
·168 lines (154 loc) · 5.46 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>zAccordion Responsive Example</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="js/jquery.zaccordion.js"></script>
<style type="text/css">
/* Just some styles to set the page layout. */
* {margin:0;padding:0;font-family:Arial, Verdana, sans-serif;}
body {padding:20px;line-height:20px;font-size:12px;color:#000;}
h1 {font-size:18px;margin:10px 0;line-height:1;}
h2 {font-size:14px;margin:10px 0;line-height:1;}
p {font-size:12px;margin:10px 0;}
small {font-size:11px;margin:10px 0;color:#333;}
a {font-size:12px;text-decoration:none;color:#f00;}
p span {color:#00f;}
#container {width:960px;margin:0 auto;padding-bottom:40px;}
#examples {margin-top:60px;}
pre {font-family:"Courier New", Courier, monospace;font-size:11px;margin:20px 0 100px 0;border:1px dashed #ddd;padding:10px;background:#f6f6f6;}
pre.html {margin:10px 0;}
.clear {clear:both;}
</style>
<script type="text/javascript">
$(document).ready(function() {
$("pre.js").each(function(index) {
eval($(this).text());
});
});
</script>
</head>
<body>
<div id="container">
<h1>zAccordion Examples</h1>
<p>This example demonstrates a responsive accordion.</p>
<div id="examples">
<style type="text/css">
#wrapper {width:860px;background:#fff6cc;border:1px dashed #ffe100;padding:20px;}
#example15 {list-style:none;visibility:hidden;}
#example15 img {display:block;max-width:100%;}
#example15 li {width:100%;}
@media only screen and (min-width: 960px) {
#wrapper {width:860px;}
}
@media only screen and (min-width: 768px) and (max-width: 959px) {
#wrapper {width:680px;}
}
@media only screen and (min-width: 480px) and (max-width: 767px) {
#wrapper {width:380px;}
}
@media only screen and (max-width: 479px) {
#wrapper {width:200px;}
#example15 {height:auto;list-style:none;}
#example15 {visibility:visible;}
}
</style>
<h2>Example 1 - A Basic Accordion</h2>
<div id="wrapper">
<ul id="example15">
<li><img src="images/slide0.gif" width="100%" height="200" alt="" /></li>
<li><img src="images/slide1.gif" width="100%" height="200" alt="" /></li>
<li><img src="images/slide2.gif" width="100%" height="200" alt="" /></li>
<li><img src="images/slide3.gif" width="100%" height="200" alt="" /></li>
<li><img src="images/slide4.gif" width="100%" height="200" alt="" /></li>
</ul>
<div class="clear"></div>
</div>
<p>There are two aspects to this example: CSS media queries and JavaScript media queries. The CSS sets up the media queries for the page layout. The JavaScript below uses Enquire.js to listen for media query matches with JavaScript.</p>
<pre class="js">
$(document).ready(function() {
var example = $('#example15'), defaults = {
buildComplete: function () {
example.css('visibility', 'visible');
},
timeout: 5500
};
function build(x) {
var opts, current;
if (!$.isEmptyObject(example.data())) { /* If an zAccordion is found, rebuild it with new settings. */
example.css('visibility', 'hidden');
current = example.data('current');
opts = $.extend({
startingSlide: current
}, defaults, x);
example.zAccordion('destroy', {
removeStyleAttr: true,
removeClasses: true,
destroyComplete: {
afterDestroy: function() {
try {
console.log('zAccordion destroyed! Attempting to rebuild...');
} catch (e) {}
},
rebuild: opts
}
});
} else { /* If no zAccordion is found, build one from scratch. */
example.css('visibility', 'hidden');
opts = $.extend(defaults, x);
example.zAccordion(opts);
}
}
/* A unique Media Query is registered for each screen size. */
enquire.register('screen and (min-width: 960px)', { /* Standard screen sizes and a default build for browsers that are unsupported. */
match : function () {
build({
slideWidth: 540,
width: 860,
height: 200
});
} /* The *true* value below means this media query will fire by default. */
}, true).register('screen and (min-width: 768px) and (max-width: 959px)', {
match : function () {
build({
slideWidth: 420,
width: 680,
height: 200
});
}
}).register('screen and (min-width: 480px) and (max-width: 767px)', {
match : function () {
build({
slideWidth: 220,
width: 380,
height: 200
});
}
}).register('screen and (max-width: 479px)', {
match : function () {
if (!$.isEmptyObject(example.data())) {
example.zAccordion('destroy', {
removeStyleAttr: true,
removeClasses: true,
destroyComplete: {
afterDestroy: function() {
try {
console.log('zAccordion destroyed!');
} catch (e) {}
}
}
});
}
}
}).listen(5);
});
</pre>
<script src="https://raw.github.com/paulirish/matchMedia.js/master/matchMedia.js"></script>
<script src="https://raw.github.com/WickyNilliams/enquire.js/master/dist/enquire.min.js"></script>
</div>
</div>
</body>
</html>