Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: elements/viewer-page-indicator/viewer-page-indicator.html

Issue 169163004: Allow click events to pass through the toolbar padding. (Closed) Base URL: https://chromium.googlesource.com/chromium/html-office-public.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <polymer-element name="viewer-page-indicator" attributes="text"> 1 <polymer-element name="viewer-page-indicator" attributes="text">
2 <template> 2 <template>
3 <link rel="stylesheet" href="viewer-page-indicator.css"> 3 <link rel="stylesheet" href="viewer-page-indicator.css">
4 <div id="text">{{text}}</div> 4 <div id="text">{{text}}</div>
5 <div id="triangle-right"></div> 5 <div id="triangle-right"></div>
6 </template> 6 </template>
7 <script> 7 <script>
8 Polymer('viewer-page-indicator', { 8 Polymer('viewer-page-indicator', {
9 text: '1', 9 text: '1',
10 timerId: undefined, 10 timerId: undefined,
11 ready: function() { 11 ready: function() {
12 var scrollCallback = function() { 12 var callback = this.fadeIn.bind(this, 2000);
13 var percent = window.scrollY / 13 window.addEventListener('scroll', function() {
14 (document.body.scrollHeight - 14 requestAnimationFrame(callback);
15 document.documentElement.clientHeight); 15 });
16 this.style.top = percent * 16 },
17 (document.documentElement.clientHeight - this.offsetHeight) + 'px'; 17 initialFadeIn: function() {
18 this.style.opacity = 1; 18 this.fadeIn(6000);
19 clearTimeout(this.timerId); 19 },
20 fadeIn: function(displayTime) {
21 var percent = window.scrollY /
22 (document.body.scrollHeight -
23 document.documentElement.clientHeight);
24 this.style.top = percent *
25 (document.documentElement.clientHeight - this.offsetHeight) + 'px';
26 this.style.opacity = 1;
27 clearTimeout(this.timerId);
20 28
21 this.timerId = setTimeout(function() { 29 this.timerId = setTimeout(function() {
22 this.style.opacity = 0; 30 this.style.opacity = 0;
23 this.timerId = undefined; 31 this.timerId = undefined;
24 }.bind(this), 2000); 32 }.bind(this), displayTime);
25 }.bind(this); 33 }
ganetsky1 2014/02/20 20:22:29 Where is the call to initialFadeIn?
raymes 2014/02/21 03:03:42 It will be called from the owner of this element.
26 window.addEventListener('scroll', function() {
27 requestAnimationFrame(scrollCallback);
28 });
29
30 scrollCallback();
31 },
32 }); 34 });
33 </script> 35 </script>
34 </polymer-element> 36 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698