-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent1.html
349 lines (306 loc) · 11.8 KB
/
event1.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
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
340
341
342
343
344
345
346
347
348
349
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html><html class=''>
<head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/ebrewe/pen/QKpbBz?depth=everything&limit=all&order=popularity&page=12&q=portfolio&show_forks=false" />
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
<style class="cp-pen-styles">@import "https://fonts.googleapis.com/css?family=Fira+Sans:300,400";
body, html {
display: block;
height: 100%;
width: 100%;
}
body {
background: #f4f4f4;
background: linear-gradient(0deg, #eae4e4, #f4f4f4);
font-family: "Fira Sans", helvetica, arial, sans-serif;
}
#portfolio {
display: block;
padding: 10px;
width: 100%;
height: 100%;
}
.gallery {
display: flex;
justify-content: space-between;
flex-flow: row wrap;
width: 100%;
}
.gallery .gallery-mask {
display: block;
position: absolute;
top: 0;
left: 0;
content: "";
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
z-index: 1;
transition: all .2s ease-out;
opacity: 0;
display: none;
}
.gallery .gallery-mask.active {
display: block;
transition: all .6s ease-out;
opacity: 1;
}
.gallery-item {
display: flex;
position: relative;
width: 30%;
height: 200px;
background-color: white;
margin-bottom: 20px;
align-items: center;
justify-content: center;
background: white no-repeat center center;
background-size: cover;
box-shadow: 3px 5px 15px -3px rgba(0, 0, 0, 0.3);
transition: all .4s ease-out;
overflow: hidden;
z-index: 5;
}
.gallery-item h2 {
color: white;
font-weight: 300;
text-transform: uppercase;
z-index: 2;
}
.gallery-item .item-mask {
display: block;
position: absolute;
top: 0;
left: 0;
content: "";
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
z-index: 1;
transition: all .2s ease-out;
}
.gallery-item:hover {
transform: scale(1.05);
}
.gallery-item:hover .item-mask {
opacity: 0;
}
.gallery-item.active {
opacity: 0;
transform: scale(0.4);
}
@media (max-width: 760px) {
.gallery-item {
width: 48%;
}
}
.card {
display: block;
position: absolute;
top: -200%;
left: 0;
width: 30%;
height: 200px;
padding: 50px;
background: white;
overflow: hidden;
z-index: 200;
box-shadow: 5px 7px 20px -5px rgba(0, 0, 0, 0.3);
}
@media (max-width: 760px) {
.card {
width: 48%;
}
}
.card .btn-close {
display: block;
position: absolute;
top: 30px;
right: 30px;
}
.card h1, .card p {
width: 500px;
transition: all .4s linear;
}
.card.active {
top: 50% !important;
left: 50% !important;
width: 600px;
height: 80%;
transform: translate(-50%, -50%);
transition: all .4s ease-in;
}
.card.active h1, .card.active p {
width: 500px;
}
@media (max-width: 760px) {
.card.active {
width: 320px;
padding: 50px 30px;
}
.card.active h1, .card.active p {
width: 260px;
}
}
.card.transit {
transform: translate(-50%, -100%);
opacity: 0;
}
.backdrop {
display: block;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: transparent no-repeat center center;
background-size: cover;
opacity: 0;
z-index: 1;
transition: opacity .6s ease-in;
}
.backdrop.active {
opacity: 1;
}
</style></head><body>
<div class="container">
<div id="portfolio"></div>
</div>
<script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script>
<script >'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _React = React;
var Component = _React.Component;
var items = [{ name: 'Bangkok', image: 'http://ericbrewer.ca/images/stockImages/Bangkok.jpg?dl=1' }, { name: 'Forest', image: 'http://ericbrewer.ca/images/stockImages/ForestJog.jpg?dl=1' }, { name: 'London', image: 'http://ericbrewer.ca/images/stockImages/londonStation.jpg?dl=1' }, { name: 'River', image: 'http://ericbrewer.ca/images/stockImages/mistRiver.jpg?dl=1' }, { name: 'New York', image: 'http://ericbrewer.ca/images/stockImages/newYork.jpg?dl=1' }, { name: 'Drive', image: 'http://ericbrewer.ca/images/stockImages/SSD.jpg?dl=1' }, { name: 'Field', image: 'http://ericbrewer.ca/images/stockImages/wheatField.jpg?dl=1' }];
var Gallery = function (_Component) {
_inherits(Gallery, _Component);
function Gallery(props) {
_classCallCheck(this, Gallery);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
_this.items = items;
_this.defaultCardPos = { top: '-200%', left: 0 };
_this.state = { activeItem: false, cardTop: _this.defaultCardPos.top, cardLeft: _this.defaultCardPos.left, cardActive: false };
return _this;
}
Gallery.prototype.handleItemClick = function handleItemClick(name, item) {
var _this2 = this;
this.setState({ activeItem: name });
var oTop = item.offsetTop,
oLeft = item.offsetLeft;
this.setState({ cardTop: oTop, cardLeft: oLeft });
this.cardTimeout = setTimeout(function () {
_this2.setState({ cardActive: true });
}, 100);
};
Gallery.prototype.getBackgroundImage = function getBackgroundImage(itemName) {
var imageItem = this.items.reduce(function (ov, nv) {
return nv.name == itemName ? nv : ov;
});
return imageItem.image;
};
Gallery.prototype.handleCardClick = function handleCardClick() {
if (!this.state.activeItem) return false;
this.setState({ cardActive: false, activeItem: false, cardTop: this.defaultCardPos.top, cardLeft: this.defaultCardPos.left });
};
Gallery.prototype.renderGallery = function renderGallery() {
var _this3 = this;
return this.items.map(function (item) {
var activeClass = _this3.state.cardActive ? 'active' : ''; //this.state.activeItem == item.name ? 'active' : '';
return React.createElement(
GalleryItem,
{ name: item.name, background: item.image, active: activeClass, clickFunction: _this3.handleItemClick.bind(_this3) },
React.createElement(
'h2',
null,
item.name
),
React.createElement('div', { className: 'item-mask' })
);
});
};
Gallery.prototype.render = function render() {
var maskActive = ''; //this.state.activeItem ? "active" : "";
var galleryBackground = this.state.activeItem ? this.getBackgroundImage(this.state.activeItem) : '';
return React.createElement(
'div',
{ className: 'gallery' },
this.renderGallery(),
React.createElement(Card, { title: this.state.activeItem, ref: 'card', top: this.state.cardTop, left: this.state.cardLeft, active: this.state.cardActive, closeFunction: this.handleCardClick.bind(this) }),
React.createElement('div', { className: 'gallery-mask ' + maskActive }),
React.createElement('div', { className: 'backdrop ' + (this.state.activeItem ? 'active' : ''), style: { 'backgroundImage': 'url(' + galleryBackground + ')' }, onClick: this.handleCardClick.bind(this) })
);
};
return Gallery;
}(Component);
var GalleryItem = function (_Component2) {
_inherits(GalleryItem, _Component2);
function GalleryItem(props) {
_classCallCheck(this, GalleryItem);
var _this4 = _possibleConstructorReturn(this, _Component2.call(this, props));
console.log(_this4.props.background);
return _this4;
}
GalleryItem.prototype.handleClick = function handleClick(e) {
e.preventDefault();
this.props.clickFunction(this.props.name, this.refs.el);
};
GalleryItem.prototype.render = function render() {
var style = { 'background-image': 'url(' + this.props.background + ')' };
return React.createElement(
'div',
{ ref: 'el', className: 'gallery-item ' + this.props.active, style: style, onClick: this.handleClick.bind(this) },
this.props.children
);
};
return GalleryItem;
}(Component);
var Card = function (_Component3) {
_inherits(Card, _Component3);
function Card(props) {
_classCallCheck(this, Card);
var _this5 = _possibleConstructorReturn(this, _Component3.call(this, props));
_this5.state = { transit: false };
return _this5;
}
Card.prototype.handleClose = function handleClose(e) {
var _this6 = this;
e.preventDefault();
this.setState({ transit: true });
this.timeout = setTimeout(function () {
_this6.setState({ transit: false });
_this6.props.closeFunction();
}, 400);
};
Card.prototype.render = function render() {
var activeClass = this.props.active ? "active" : "";
var transitClass = this.state.transit ? "transit" : "";
return React.createElement(
'div',
{ className: 'card ' + activeClass + ' ' + transitClass, style: { 'left': this.props.left, 'top': this.props.top } },
React.createElement(
'h2',
null,
this.props.title
),
React.createElement(
'a',
{ className: 'btn-close', onClick: this.handleClose.bind(this) },
'Close x'
),
React.createElement(
'p',
null,
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus placerat vitae mi ut lobortis. In vehicula, risus eu rhoncus ornare, augue mauris volutpat justo, ut pellentesque libero turpis quis leo. Nam id porttitor enim, eget tempor arcu. Nulla blandit accumsan tellus in tristique. Praesent pellentesque quis nisi sit amet accumsan. Cras quam dui, pulvinar eget finibus eget, tincidunt in nisl. Vestibulum vulputate fringilla odio, eu porta mi porta ut. Cras fermentum porttitor mi, vel dignissim dui egestas sed. Pellentesque sapien nunc, commodo ut libero at, molestie venenatis urna. Fusce commodo enim magna, ac efficitur arcu dictum in.'
)
);
};
return Card;
}(Component);
ReactDOM.render(React.createElement(Gallery, null), document.getElementById('portfolio'));
//# sourceURL=pen.js
</script>
</body></html>