style.scss
6.1 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
@import 'bourbon'; // http://bourbon.io/
@import '../partials/variables'; // colors, fonts etc...
@import '../partials/mixins'; // custom mixins
@import '../partials/layout'; // responsive grid and media queries
/* --------------------------------
Primary style
-------------------------------- */
*, *::after, *::before {
@include box-sizing(border-box);
}
html {
font-size: 62.5%;
}
body {
font: {
size: 1.6rem;
family: $primary-font; // variables inside partials > _variables.scss
}
color: $color-1;
background-color: $color-3;
}
a {
color: $color-2;
text-decoration: none;
}
/* --------------------------------
Main Components
-------------------------------- */
.cd-gallery {
width: 90%;
max-width: $L; // breakpoints inside partials > _layout.scss
margin: 1.5em auto;
@include clearfix;
> li {
overflow: hidden;
position: relative;
margin-bottom: 2em;
background: $color-5;
border-radius: .25em;
box-shadow: 0 1px 4px rgba(#000, .1);
> a {
display: block;
}
}
@include MQ(M) {
margin: 2em auto;
> li {
@include column(.48); // see partials > _layout.scss
margin-right: 4%;
margin-bottom: 2.5em;
&:nth-of-type(2n) {
margin-right: 0;
}
}
}
@include MQ(L) {
margin: 2.5em auto;
> li {
.no-touch &:hover .cd-dots li.selected a {
/* Slider dots - change background-color of the selected dot when hover over the its parent list item */
background: $color-1;
border-color: $color-1;
}
.no-touch &:hover .cd-dots a {
/* Slider dots - change dot border-color when hover over the its parent list item */
border-color: lighten($color-1, 40%);
}
.no-touch &:hover li.move-right,
.no-touch &:hover li.move-left {
/* show preview items when hover over the its parent list item */
opacity: 0.3;
}
}
}
}
.cd-item-wrapper {
position: relative;
overflow: hidden;
margin: 3em 0;
li {
position: absolute;
top: 0;
left: 25%;
height: 100%;
width: 50%;
opacity: 0;
/* Force Hardware Acceleration */
@include transform(translateZ(0));
@include backface-visibility(hidden);
will-change: transform, opacity;
@include transform(translateX(200%) scale(0.7));
@include transition(transform .4s, opacity .4s);
&.selected {
/* selected item */
position: relative;
opacity: 1;
@include transform(translateX(0) scale(1.3));
}
&.move-left {
/* item on left - preview visible */
@include transform(translateX(-100%) scale(0.7));
opacity: 0.3;
}
&.move-right {
/* item on right - preview visible */
@include transform(translateX(100%) scale(0.7));
opacity: 0.3;
}
&.hide-left {
/* items hidden on the left */
@include transform(translateX(-200%) scale(0.7));
}
img {
display: block;
width: 100%;
}
}
@include MQ(L) {
li.move-left,
li.move-right {
/* hide preview items */
opacity: 0;
}
li.focus-on-left {
/* class added to the .selected and .move-right items when user hovers over the .move-left item (item preview on the left) */
@include transform(translateX(3%) scale(1.25));
&.move-right {
@include transform(translateX(103%) scale(0.7));
}
}
li.focus-on-right {
/* class added to the .selected and .move-left items when user hovers over the .move-right item (item preview on the right) */
@include transform(translateX(-3%) scale(1.25));
&.move-left {
@include transform(translateX(-103%) scale(0.7));
}
}
li.hover {
/* class added to the preview items (.move-left or .move-right) when user hovers over them */
opacity: 1 !important;
&.move-left {
@include transform(translateX(-97%) scale(0.75));
}
&.move-right {
@include transform(translateX(97%) scale(0.75));
}
}
}
}
.cd-dots {
/* not visible in the html document - created using jQuery */
position: absolute;
bottom: 95px;
@include center(x); // see partials > _mixins.scss
@include clearfix;
padding: .2em;
li {
display: inline-block;
float: left;
margin: 0 5px;
pointer-events: none;
&.selected a {
background: $color-1;
border-color: $color-1;
}
}
a {
display: block;
height: 6px;
width: 6px;
border-radius: 50%;
border: 1px solid lighten($color-1, 40%);
/* image replacement */
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
@include transition(border-color .2s, background-color .2s);
}
@include MQ(L) {
li {
pointer-events: auto;
&.selected a {
background: darken($color-5, 20%);
border-color: darken($color-5, 20%);
}
}
a {
height: 8px;
width: 8px;
border-color: darken($color-5, 20%);
/* fix a bug in IE9/10 - transparent anchor not clickable */
background-color: rgba(#FFF, 0);
}
}
}
.cd-item-info {
height: 90px;
line-height: 90px;
padding: 0 2em;
@include clearfix;
b, .cd-price, .cd-new-price {
font-weight: bold;
font-size: 2rem;
}
b {
float: left;
a {
color: $color-1;
}
}
.cd-price, .cd-new-price {
/* .cd-new-price not visible in the html document - created using jQuery */
float: right;
}
.cd-price {
color: $color-2;
position: relative;
margin-left: 10px;
@include transition(color .2s);
&::after {
/* crossing line - visible if price is on sale */
content:'';
position: absolute;
@include center(y);
left: 0;
height: 2px;
width: 0%;
background-color: $color-2;
opacity: 0;
@include transition(width .2s 0s, opacity 0s .2s);
}
&.on-sale::after {
opacity: 1;
width: 100%;
@include transition(width .2s 0s, opacity 0s 0s);
}
}
.cd-new-price {
/* new price - visible if price is on sale */
color: $color-4;
opacity: 0;
@include transform(translateX(5px));
@include transition(transform .2s, opacity .2s);
&.is-visible {
@include transform(translateX(0));
opacity: 1;
}
}
@include MQ(M) {
b, .cd-price, .cd-new-price {
font-size: 2.4rem;
}
}
}
.no-js .move-right,
.no-js .move-left {
display: none;
}
/* --------------------------------
xcredits
-------------------------------- */
.credits {
width: 90%;
margin: 2em auto;
text-align: center;
}
.no-touch .credits a:hover {
text-decoration: underline;
}