-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimage-grid-item-expand.html
71 lines (59 loc) · 1.83 KB
/
image-grid-item-expand.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
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="image-grid-item.html">
<polymer-element name="image-grid-item-expand" extends="image-grid-item">
<template>
<link rel="stylesheet" href="image-grid-item-expand.css" />
<div class="wrapper" on-click="{{_onItemClick}}">
<div class="wrapper-content">
<shadow></shadow>
</div>
</div>
<div class="content">
<content select="section"></content>
</div>
<div class="close" on-click="{{_onCloseClick}}"></div>
</template>
<script>
Polymer({
/**
* The callback to when the element’s initial set of
* children are guaranteed to exist.
* @method
*/
domReady: function () {
this.super();
this._wrapper = this.shadowRoot.querySelector('.wrapper');
this._content = this.shadowRoot.querySelector('.content');
this._close = this.shadowRoot.querySelector('.close');
},
/**
* Callback to an item click.
*
* @method
* @private
*/
_onItemClick: function () {
this._wrapper.classList.add('wrapper-scale');
this.async(function () {
this._wrapper.classList.add('wrapper-translate');
this._content.classList.add('content-visible');
this._close.classList.add('close-visible');
}, null, 600);
},
/**
* Callback to a close click.
*
* @method
* @private
*/
_onCloseClick: function () {
this._content.classList.remove('content-visible');
this._close.classList.remove('close-visible');
this.async(function () {
this._wrapper.classList.remove('wrapper-translate');
this._wrapper.classList.remove('wrapper-scale');
}, null, 250);
}
});
</script>
</polymer-element>