-
Notifications
You must be signed in to change notification settings - Fork 359
/
index.html
160 lines (143 loc) · 3.73 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
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
<!doctype html>
<html>
<head>
<title>Stretch background image using CSS3 background-size, in IE8 too.</title>
<link href='http://fonts.googleapis.com/css?family=Great+Vibes' rel='stylesheet' type='text/css'>
<style>
/* set the background of the body */
body {
margin: 0;
background: url(images/algeria.jpg) center no-repeat;
-ms-behavior: url(backgroundsize.min.htc);
behavior: url(backgroundsize.min.htc);
}
.bgsCover {
background-size: cover;
}
.bgsContain {
background-size: contain;
}
/* this allows to use a second background in all browsers and IE8 */
body:after {
content: "";
background: url(images/pattern.png) repeat;
position: absolute;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
/* responsive carousel FTW */
#carousel {
height: 45%;
width: 50%;
margin: 0 auto;
background: #0F0808;
border-radius: 3px;
}
#carousel ul {
height: 100%;
padding: 0;
margin: 0;
list-style: none;
}
#carousel li {
display: none;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
-ms-behavior: url(backgroundsize.min.htc);
behavior: url(backgroundsize.min.htc);
}
#carousel .active {
display: block;
}
/* less interesting stuff below */
html, body {
height: 100%;
font-family: "Arial", "Liberation Sans", sans-serif;
color: #FEE;
}
h1 {
font-family: 'Great Vibes', sans-serif;
text-align: center;
margin: 0 0 40px;
text-shadow: 0 0 2px #222;
font-size: 1.7em;
font-weight: normal;
position: relative;
top: 20px;
}
h1 i {
font-size: 1.3em;
display: block;
-moz-transform: rotate(-15deg);
-webkit-transform: rotate(-15deg);
-o-transform: rotate(-15deg);
-ms-transform: rotate(-15deg);
transform: rotate(-15deg);
}
p {
text-align: center;
font-size: 1.5em;
text-shadow: 0 0 2px #222;
}
.button {
color: #0F0808;
text-decoration: none;
background: #FEE;
border-radius: 3px;
text-shadow: none;
padding: 4px 8px;
}
</style>
</head>
<body class="bgsCover">
<h1><i>background-size</i> polyfill</h1>
<a href="https://github.com/louisremi/background-size-polyfill"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub"></a>
<div id="carousel">
<ul>
<li id="img1" class="active" style="background-image: url(images/algerian1.jpg);">
<li id="img2" style="background-image: url(images/jar1.jpg);">
<li id="img3" style="background-image: url(images/algerian2.jpg);">
<li id="img4" style="background-image: url(images/jar2.jpg);">
</ul>
</div>
<p>Stretch background image using CSS3 <code>background-size: cover;</code> and <code>background-size: contain;</code>, in IE8 too.<br/>
Reacts to resize events for responsive backgrounds and galeries!</p>
<p><a class="button" href="https://github.com/louisremi/background-size-polyfill#readme">Instructions</a> - <a class="button" href="https://github.com/louisremi/background-size-polyfill/downloads">Downloads</a></p>
<script>
/*var images = [
'algeria.jpg',
'parthenon.jpg',
'propylaea.jpg'
],
curImg = 0;
document.getElementById("switchImage").onclick = function() {
curImg = ( curImg + 1 ) % images.length;
document.body.style.backgroundImage = "url(images/" + images[ curImg ] + ")";
};
var sizes = [
"Cover",
"Contain",
"Auto"
],
curSize = 0;
document.getElementById("switchSize").onclick = function() {
curSize = ( curSize + 1 ) % sizes.length;
document.body.className = "bgs" + sizes[ curSize ];
};*/
window.onload = function() {
var items = document.getElementById("carousel").getElementsByTagName("li"),
curItem = 0;
setInterval(function() {
items[ curItem ].className = "";
curItem = ( curItem + 1 ) % items.length;
items[ curItem ].className = "active";
}, 3000);
};
</script>
</body>
</html>