1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 is
: 'viewer-page-indicator',
16 observer
: 'indexChanged'
22 observer
: 'pageLabelsChanged'
29 var callback
= this.fadeIn
.bind(this, 2000);
30 window
.addEventListener('scroll', function() {
31 requestAnimationFrame(callback
);
35 initialFadeIn: function() {
39 fadeIn: function(displayTime
) {
40 var percent
= window
.scrollY
/
41 (document
.body
.scrollHeight
-
42 document
.documentElement
.clientHeight
);
43 this.style
.top
= percent
*
44 (document
.documentElement
.clientHeight
- this.offsetHeight
) + 'px';
45 this.style
.opacity
= 1;
46 clearTimeout(this.timerId
);
48 this.timerId
= setTimeout(function() {
49 this.style
.opacity
= 0;
50 this.timerId
= undefined;
51 }.bind(this), displayTime
);
54 pageLabelsChanged: function() {
58 indexChanged: function() {
60 this.label
= this.pageLabels
[this.index
];
62 this.label
= String(this.index
+ 1);