|
7 | 7 |
|
8 | 8 | <!-- Please be aware that this prevents the user from scaling your website via pinch-gesture. The user is not able to zoom text or other elements. If you need scaling, do not use this snippet but the one listed on h5bp.com/viewport -->
|
9 | 9 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
10 |
| - <style type="text/css"> |
11 |
| - /* start normalize */ |
12 |
| - article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif;color:#222}body{margin:0;font-size:1em;line-height:1.4} |
13 |
| - a { color: #00e; } |
14 |
| - a:visited { color: #551a8b; } |
15 |
| - a:hover { color: #06e; } |
16 |
| - a:focus { outline: thin dotted; } |
17 |
| - a:hover, a:active { outline: 0; } |
18 |
| - abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}ins{background:#ff9;color:#000;text-decoration:none}mark{background:#ff0;color:#000;font-style:italic;font-weight:bold}pre,code,kbd,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:before,q:after{content:"";content:none}small{font-size:85%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}ul,ol{margin:1em 0;padding:0 0 0 40px}dd{margin:0 0 0 40px}nav ul,nav ol{list-style:none;list-style-image:none;margin:0;padding:0}img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:0;margin:0;padding:0}label{cursor:pointer}legend{border:0;*margin-left:-7px;padding:0;white-space:normal}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;*overflow:visible}button[disabled],input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*width:13px;*height:13px}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top;resize:vertical}input:invalid,textarea:invalid{background-color:#f0dddd}table{border-collapse:collapse;border-spacing:0}td{vertical-align:top}.invisible{visibility:hidden}.clearfix:before,.clearfix:after{content:"";display:table}.clearfix:after{clear:both}.clearfix{*zoom:1} |
19 |
| - /* normalize finished, your css below */ |
20 |
| - |
21 |
| - /* User customizable settings */ |
22 |
| - |
23 |
| - #slide-1, |
24 |
| - #slide-2, |
25 |
| - #slide-3, |
26 |
| - #slide-4 { |
27 |
| - background-size: cover; |
28 |
| - } |
29 |
| - |
30 |
| - #slide-1 { |
31 |
| - background-image: url('slide-1.jpg'); |
32 |
| - } |
33 |
| - |
34 |
| - #slide-2 { |
35 |
| - background-image: url('slide-2.jpg'); |
36 |
| - } |
37 |
| - |
38 |
| - #slide-3 { |
39 |
| - background-image: url('slide-3.jpg'); |
40 |
| - } |
41 |
| - |
42 |
| - #slide-4 { |
43 |
| - background-image: url('slide-4.jpg'); |
44 |
| - } |
45 |
| - |
46 |
| - /* CSS Components */ |
47 |
| - |
48 |
| - .slider-wrapper { |
49 |
| - position: relative; |
50 |
| - width: 100%; |
51 |
| - height: 22rem; |
52 |
| - |
53 |
| - overflow: hidden; |
54 |
| - |
55 |
| - /* Dark background for nice transition effect */ |
56 |
| - background: #000; |
57 |
| - } |
58 |
| - |
59 |
| - /* Slider Start */ |
60 |
| - |
61 |
| - .slider-content { |
62 |
| - padding: 0; |
63 |
| - margin: 0; |
64 |
| - max-height: 100%; |
65 |
| - |
66 |
| - list-style: none; |
67 |
| - overflow: hidden; |
68 |
| - } |
69 |
| - |
70 |
| - .slider-content > li { |
71 |
| - position: relative; |
72 |
| - float: left; |
73 |
| - |
74 |
| - overflow: hidden; |
75 |
| - opacity: 0; |
76 |
| - |
77 |
| - -webkit-transform: translate3d(0, 0, 0); |
78 |
| - -moz-transform: translate3d(0, 0, 0); |
79 |
| - -o-transform: translate3d(0, 0, 0); |
80 |
| - -ms-transform: translate3d(0, 0, 0); |
81 |
| - transform: translate3d(0, 0, 0); |
82 |
| - |
83 |
| - -webkit-backface-visibility: hidden; |
84 |
| - -moz-backface-visibility: hidden; |
85 |
| - backface-visibility: hidden; |
86 |
| - |
87 |
| - -webkit-perspective: 1000; |
88 |
| - -moz-perspective: 1000; |
89 |
| - perspective: 1000; |
90 |
| - |
91 |
| - /* Transition mode: cover-flow; |
92 |
| - doesn't work with position: absolute on li's */ |
93 |
| - -webkit-transition: all 1500ms ease-in-out; |
94 |
| - -moz-transition: all 1500ms ease-in-out; |
95 |
| - -o-transition: all 1500ms ease-in-out; |
96 |
| - -ms-transition: all 1500ms ease-in-out; |
97 |
| - transition: all 1500ms ease-in-out; |
98 |
| - |
99 |
| - /* Transition mode: push; */ |
100 |
| - -webkit-transition: width 1000ms ease-in-out; |
101 |
| - -moz-transition: width 1000ms ease-in-out; |
102 |
| - -o-transition: width 1000ms ease-in-out; |
103 |
| - -ms-transition: width 1000ms ease-in-out; |
104 |
| - transition: width 1000ms ease-in-out; |
105 |
| - |
106 |
| - /* Transition mode: opacity; */ |
107 |
| - -webkit-transition: opacity 750ms ease-in-out; |
108 |
| - -moz-transition: opacity 750ms ease-in-out; |
109 |
| - -o-transition: opacity 750ms ease-in-out; |
110 |
| - -ms-transition: opacity 750ms ease-in-out; |
111 |
| - transition: opacity 750ms ease-in-out; |
112 |
| - } |
113 |
| - |
114 |
| - .slider-content > li:not(:target) { |
115 |
| - opacity: 0; |
116 |
| - width: 0; |
117 |
| - } |
118 |
| - |
119 |
| - .slider-content > li:target, |
120 |
| - .slider-content > .active { |
121 |
| - opacity: 1; |
122 |
| - width: 100%; |
123 |
| - height: 22rem; |
124 |
| - } |
125 |
| - |
126 |
| - .slider-content > .active { |
127 |
| - opacity: 1 !important; |
128 |
| - width: 100% !important; |
129 |
| - } |
130 |
| - |
131 |
| - .slider--bullets { |
132 |
| - position: absolute; |
133 |
| - z-index: 30; |
134 |
| - |
135 |
| - width: 4rem; |
136 |
| - height: 1rem; |
137 |
| - left: 47.5%; |
138 |
| - bottom: 1rem; |
139 |
| - } |
140 |
| - |
141 |
| - .slider--bullets > li { |
142 |
| - display: inline-block; |
143 |
| - } |
144 |
| - |
145 |
| - .slider--bullets > li > a { |
146 |
| - margin: auto; |
147 |
| - max-width: none; |
148 |
| - text-decoration: none; |
149 |
| - font-family: Helvetica, Arial, sans-serif !important; |
150 |
| - } |
151 |
| - |
152 |
| - .slider--bullets > li > a:before { |
153 |
| - position: relative; |
154 |
| - z-index: 90; |
155 |
| - |
156 |
| - display: block; |
157 |
| - |
158 |
| - content: '\2022'; |
159 |
| - font-size: 1.5rem; |
160 |
| - line-height: 1; |
161 |
| - text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25); |
162 |
| - |
163 |
| - color: rgba(255, 255, 255, 0.65); |
164 |
| - } |
165 |
| - |
166 |
| - .slider--bullets > li > a.active:before { |
167 |
| - color: #fff; |
168 |
| - } |
169 |
| - |
170 |
| - /* Slider End */ |
171 |
| - |
172 |
| - |
173 |
| - .slider-content > li > h2, |
174 |
| - .slider-content > li > p, |
175 |
| - .slider-content > li > a { |
176 |
| - max-width: 27rem; |
177 |
| - margin-left: 1rem; |
178 |
| - } |
179 |
| - |
180 |
| - .slider-content > li > h2, |
181 |
| - .slider-content > li > p { |
182 |
| - text-shadow: 0 0 5px rgba(0, 0, 0, 0.75); |
183 |
| - } |
184 |
| - |
185 |
| - .slider-content > li > h2 { |
186 |
| - margin-top: 8rem; |
187 |
| - |
188 |
| - font-family: 'museo-slab', Times, serif; |
189 |
| - font-weight: 500; |
190 |
| - line-height: 1; |
191 |
| - letter-spacing: 1px; |
192 |
| - } |
193 |
| - |
194 |
| - .slider-content > li > h3, |
195 |
| - .slider-content > li > p { |
196 |
| - margin: 0 0 0 1rem; |
197 |
| - |
198 |
| - font-family: 'Helvetica Neue', 'Helvetica', 'Segoe UI Light', sans-serif; |
199 |
| - |
200 |
| - color: #fff; |
201 |
| - } |
202 |
| - |
203 |
| - .slider-content > li > h3 { |
204 |
| - margin-top: 12rem; |
205 |
| - font-size: 3rem; |
206 |
| - |
207 |
| - font-weight: 100; |
208 |
| - letter-spacing: 1px; |
209 |
| - } |
210 |
| - |
211 |
| - .slider-content > li > p { |
212 |
| - font-weight: 100; |
213 |
| - letter-spacing: 2px; |
214 |
| - |
215 |
| - max-width: 17rem; |
216 |
| - } |
217 |
| - |
218 |
| - .slider-clickframe { |
219 |
| - position: absolute; |
220 |
| - top: 0; |
221 |
| - left: 0; |
222 |
| - right: 0; |
223 |
| - bottom: 0; |
224 |
| - z-index: 20; |
225 |
| - width: 100%; |
226 |
| - height: 100%; |
227 |
| - background: #fff; |
228 |
| - opacity: 0; |
229 |
| - filter: alpha(opacity=0); |
230 |
| - |
231 |
| - -webkit-tap-highlight-color: rgba(0,0,0,0); |
232 |
| - } |
233 |
| - </style> |
| 10 | + <link rel="stylesheet" href="site/css/normalize.css"> |
| 11 | + <link rel="stylesheet" href="slider.css"> |
234 | 12 | </head>
|
235 | 13 | <body>
|
236 | 14 |
|
@@ -268,127 +46,6 @@ <h3>Warsaw at Night</h3>
|
268 | 46 |
|
269 | 47 | </section>
|
270 | 48 |
|
271 |
| - <script> |
272 |
| - |
273 |
| - var cssSlider = { |
274 |
| - |
275 |
| - // CSS-Slider selectors |
276 |
| - selectors: { |
277 |
| - container: 'slider-wrapper', |
278 |
| - sliderItems: '.slider-content > li', |
279 |
| - firstSlide: '.slider-content > li:first-child', |
280 |
| - activeSlide: '.slider-content > .active', |
281 |
| - clickFrame: '.slider-clickframe', |
282 |
| - activeBullet: '.slider--bullets .active', |
283 |
| - allBulletLinks: 'a[href^="#slide-"]', |
284 |
| - }, |
285 |
| - |
286 |
| - // Object to remove the class attr of 1st child if 1st child isn't active |
287 |
| - sliderRemoveFirstClass: function() { |
288 |
| - |
289 |
| - var hash = window.location.hash; |
290 |
| - |
291 |
| - if(hash != "" && hash !== '#slide-1') { |
292 |
| - document.querySelector(cssSlider.selectors.firstSlide).removeAttribute('class'); |
293 |
| - } |
294 |
| - |
295 |
| - }, |
296 |
| - |
297 |
| - setClickFrame: function() { |
298 |
| - |
299 |
| - var getContainer = document.getElementsByClassName(cssSlider.selectors.container); |
300 |
| - var newNode = document.createElement("a"); |
301 |
| - |
302 |
| - var hash = window.location.hash; |
303 |
| - var getHashId = 1; // Set initial value to 1 as this the 1st is always loaded |
304 |
| - |
305 |
| - if(hash !== '') { |
306 |
| - getHashId = hash.match(/\d+(\.\d+)?/g); |
307 |
| - getHashId = parseInt(getHashId[0]); |
308 |
| - } |
309 |
| - |
310 |
| - var maxCount = document.querySelectorAll(cssSlider.selectors.sliderItems).length; |
311 |
| - var nextItem; |
312 |
| - |
313 |
| - if(getHashId < maxCount) { |
314 |
| - nextItem = getHashId+1; |
315 |
| - } else { |
316 |
| - nextItem = 1; |
317 |
| - } |
318 |
| - |
319 |
| - newNode.setAttribute('class', 'slider-clickframe'); |
320 |
| - newNode.setAttribute('href', '#slide-'+nextItem); |
321 |
| - |
322 |
| - getContainer[0].appendChild(newNode); |
323 |
| - |
324 |
| - }, |
325 |
| - |
326 |
| - changeClickFrame: function() { |
327 |
| - |
328 |
| - var getClickFrame = document.querySelector(cssSlider.selectors.clickFrame); |
329 |
| - |
330 |
| - var hash = window.location.hash; |
331 |
| - var getHashId = hash.match(/\d+(\.\d+)?/g); |
332 |
| - |
333 |
| - var maxCount = document.querySelectorAll(cssSlider.selectors.sliderItems).length; |
334 |
| - var nextItem; |
335 |
| - |
336 |
| - getHashId = parseInt(getHashId[0]); |
337 |
| - |
338 |
| - if(getHashId < maxCount) { |
339 |
| - nextItem = getHashId+1; |
340 |
| - } else { |
341 |
| - nextItem = 1; |
342 |
| - } |
343 |
| - |
344 |
| - getClickFrame.setAttribute('href', '#slide-'+nextItem); |
345 |
| - |
346 |
| - }, |
347 |
| - |
348 |
| - setActiveItems: function() { |
349 |
| - |
350 |
| - var hash = window.location.hash; |
351 |
| - |
352 |
| - // Set active Slide |
353 |
| - var getActiveSlide = document.querySelector(cssSlider.selectors.activeSlide); |
354 |
| - |
355 |
| - if (getActiveSlide !== null) { |
356 |
| - getActiveSlide.removeAttribute('class'); |
357 |
| - } |
358 |
| - |
359 |
| - // Set active Bullet |
360 |
| - var activeSlideBullet = document.querySelector(cssSlider.selectors.activeBullet); |
361 |
| - var sliderBulletArray = document.querySelectorAll(cssSlider.selectors.allBulletLinks); |
362 |
| - |
363 |
| - // Remove old active Class |
364 |
| - activeSlideBullet.removeAttribute('class'); |
365 |
| - |
366 |
| - // Set new active Class |
367 |
| - document.querySelector('a[href="'+hash+'"]').setAttribute('class', 'active'); |
368 |
| - }, |
369 |
| - |
370 |
| - init: function() { |
371 |
| - var hash = window.location.hash; |
372 |
| - |
373 |
| - // Set clickable frame on Slider |
374 |
| - window.addEventListener('DOMContentLoaded', cssSlider.setClickFrame); |
375 |
| - window.addEventListener('hashchange', cssSlider.changeClickFrame); |
376 |
| - |
377 |
| - // Set active item |
378 |
| - window.addEventListener('hashchange', cssSlider.setActiveItems); |
379 |
| - |
380 |
| - if(hash.indexOf("slide-") >= 0) { |
381 |
| - window.addEventListener('DOMContentLoaded', cssSlider.setActiveItems); |
382 |
| - } |
383 |
| - |
384 |
| - } |
385 |
| - |
386 |
| - }; |
387 |
| - |
388 |
| - // Initialize cssSlider |
389 |
| - cssSlider.init(); |
390 |
| - |
391 |
| - </script> |
392 |
| - |
| 49 | + <script src="slider.js"></script> |
393 | 50 | </body>
|
394 | 51 | </html>
|
0 commit comments