| 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}}"> |
| 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) { |
| 17 this.fadingIn = true; |
| 18 this.updateStyle(); |
| 19 }, |
| 20 fadeOut: function() { |
| 21 this.fadingIn = false; |
| 22 this.updateStyle(); |
| 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; |
| 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); |
| 38 } |
| 39 } |
| 40 } |
| 41 }); |
| 42 </script> |
| 43 </polymer-element> |
| OLD | NEW |