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 timerId: undefined, |
| 14 ready: function() { |
| 15 this.fadingInChanged(); |
| 16 }, |
| 17 fadeIn: function() { |
| 18 this.fadingIn = true; |
| 19 }, |
| 20 fadeOut: function() { |
| 21 this.fadingIn = false; |
| 22 }, |
| 23 fadingInChanged: function() { |
| 24 if (this.fadingIn) { |
| 25 this.style.opacity = 1; |
| 26 if (this.timerId !== undefined) { |
| 27 clearTimeout(this.timerId); |
| 28 this.timerId = undefined; |
| 29 } |
| 30 } else { |
| 31 if (this.timerId === undefined) { |
| 32 this.timerId = setTimeout( |
| 33 function() { |
| 34 this.style.opacity = 0; |
| 35 this.timerId = undefined; |
| 36 }.bind(this), 3000); |
| 37 } |
| 38 } |
| 39 } |
| 40 }); |
| 41 </script> |
| 42 </polymer-element> |
OLD | NEW |