Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <polymer-element name="viewer-toolbar"> | |
| 2 <template> | |
| 3 <link rel="stylesheet" href="viewer-toolbar.css"> | |
| 4 <div id="hover" on-mouseover="{{fadeIn}}" on-mousemove="{{fadeIn}}" on-mouse out="{{fadeOut}}"> | |
|
ganetsky1
2013/12/17 20:57:32
You can probably kill the div, and move these hand
raymes
2013/12/18 04:46:57
Done.
| |
| 5 <div id="toolbar"> | |
| 6 <content></content> | |
| 7 </div> | |
| 8 </div> | |
| 9 </template> | |
| 10 <script> | |
| 11 Polymer('viewer-toolbar', { | |
| 12 fadingIn: false, | |
| 13 ready: function() { | |
| 14 this.fadeOut(); | |
| 15 }, | |
| 16 fadeIn: function(event, detail, sender) { | |
|
ganetsky1
2013/12/17 20:57:32
Are the arguments necessary?
raymes
2013/12/18 04:46:57
Done.
| |
| 17 this.fadingIn = true; | |
| 18 this.updateStyle(); | |
| 19 }, | |
| 20 fadeOut: function() { | |
| 21 this.fadingIn = false; | |
|
ganetsky1
2013/12/17 20:57:32
Do you intend for fadingIn to be public or private
raymes
2013/12/18 04:46:57
It seems easier to have it public based on your hi
| |
| 22 this.updateStyle(); | |
|
ganetsky1
2013/12/17 20:57:32
I think it would be be just have a fadingIn publis
raymes
2013/12/18 04:46:57
Done.
| |
| 23 }, | |
| 24 updateStyle: function() { | |
| 25 if (this.fadingIn) { | |
| 26 this.style.setProperty("-webkit-transition", | |
| 27 "opacity 0.4s ease-in-out"); | |
| 28 this.style.opacity = 1; | |
|
ganetsky1
2013/12/17 20:57:32
You can probably just set this all up with data bi
raymes
2013/12/18 04:46:57
Cool - I didn't know you could do that! I've gone
| |
| 29 } else { | |
| 30 if (window.getComputedStyle(this).getPropertyValue("opacity") == 1) { | |
| 31 this.style.setProperty("-webkit-transition", | |
| 32 "opacity 0.4s ease-in-out 3s"); | |
| 33 this.style.opacity = 0; | |
| 34 } else { | |
| 35 // Let the toolbar finish fading in before fading out. | |
| 36 var me = this; | |
| 37 setTimeout(function() { me.updateStyle(); }, 400); | |
|
ganetsky1
2013/12/17 20:57:32
Delete var me = this
Change to setTimeout(this.upd
raymes
2013/12/18 04:46:57
Done.
| |
| 38 } | |
| 39 } | |
| 40 } | |
| 41 }); | |
| 42 </script> | |
| 43 </polymer-element> | |
| OLD | NEW |