OLD | NEW |
---|---|
(Empty) | |
1 <polymer-element name="viewer-toolbar" attributes="fadingIn" | |
2 on-mouseover="{{fadeIn}}" on-mousemove="{{fadeIn}}" | |
3 on-mouseout="{{fadeOut}}"> | |
4 <template> | |
5 <link rel="stylesheet" href="viewer-toolbar.css"> | |
6 <div id="toolbar"> | |
7 <content></content> | |
8 </div> | |
9 </template> | |
10 <script> | |
11 Polymer('viewer-toolbar', { | |
12 fadingIn: false, | |
13 ready: function() { | |
14 this.fadingInChanged(); | |
ganetsky1
2013/12/18 20:05:05
Not sure this is necessary, considering you set fa
raymes
2013/12/18 23:28:54
When I tested this, it is needed. It seems like it
| |
15 }, | |
16 fadeIn: function() { | |
17 this.fadingIn = true; | |
18 }, | |
19 fadeOut: function() { | |
20 this.fadingIn = false; | |
21 }, | |
22 fadingInChanged: function() { | |
ganetsky1
2013/12/18 20:05:05
fyi, you can use oldValue, newValue as arguments h
| |
23 if (this.fadingIn) { | |
24 this.style.setProperty("-webkit-transition", | |
25 "opacity 0.4s ease-in-out"); | |
26 this.style.opacity = 1; | |
27 } else { | |
28 if (window.getComputedStyle(this).getPropertyValue("opacity") == 1) { | |
29 this.style.setProperty("-webkit-transition", | |
30 "opacity 0.4s ease-in-out 3s"); | |
31 this.style.opacity = 0; | |
32 } else { | |
33 // Let the toolbar finish fading in before fading out. | |
34 setTimeout(this.fadingInChanged.bind(this), 400); | |
ganetsky1
2013/12/18 20:05:05
Do you really want to call the change watcher agai
raymes
2013/12/18 23:28:54
Yep I want to call the change watcher again. Basic
ganetsky1
2013/12/19 21:52:50
I think your timing is off. I think what you want
raymes
2013/12/20 01:47:30
Hmm, not sure how the timing is off?
This code sa
| |
35 } | |
36 } | |
37 } | |
38 }); | |
39 </script> | |
40 </polymer-element> | |
OLD | NEW |