diff options
author | Eric Bidelman | 2012-04-13 13:00:00 -0700 |
---|---|---|
committer | Eric Bidelman | 2012-04-13 13:00:00 -0700 |
commit | 143b67bc308926438f1b8c6860fc44993de50a5b (patch) | |
tree | c92d941a98773af6d8af8edf969acad9f6a2af5b /js | |
parent | 9118fa551c30ecda1b0e78af6418284460822d75 (diff) | |
download | io-slides-remote-143b67bc308926438f1b8c6860fc44993de50a5b.tar.gz |
Removing extra width setter
Diffstat (limited to 'js')
-rw-r--r-- | js/slides.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/slides.js b/js/slides.js index d1b094b..5363183 100644 --- a/js/slides.js +++ b/js/slides.js | |||
@@ -75,6 +75,33 @@ SlideDeck.prototype.onDomLoaded_ = function(e) { | |||
75 | SlideDeck.prototype.addEventListeners_ = function() { | 75 | SlideDeck.prototype.addEventListeners_ = function() { |
76 | document.addEventListener('keydown', this.onBodyKeyDown_.bind(this), false); | 76 | document.addEventListener('keydown', this.onBodyKeyDown_.bind(this), false); |
77 | window.addEventListener('popstate', this.onPopState_.bind(this), false); | 77 | window.addEventListener('popstate', this.onPopState_.bind(this), false); |
78 | |||
79 | var slides = document.querySelector('slides'); | ||
80 | slides.addEventListener('slideenter', | ||
81 | this.handleSlideMovement_.bind(this), false); | ||
82 | slides.addEventListener('slideleave', | ||
83 | this.handleSlideMovement_.bind(this), false); | ||
84 | }; | ||
85 | |||
86 | /** | ||
87 | * @private | ||
88 | * Callback to perform generic tasks on slideenter/slideleave events. | ||
89 | */ | ||
90 | SlideDeck.prototype.handleSlideMovement_ = function(e) { | ||
91 | var slide = e.target; | ||
92 | var gdbar = slide.querySelector('aside[is="x-gdbar"]'); | ||
93 | if (gdbar) { | ||
94 | if (e.type == 'slideenter') { | ||
95 | // Need slight delay here for case where you're on the current slide | ||
96 | // and the animation needs to run. This is because the web compontents | ||
97 | // polyfill fires on DOMContentLoaded (e.g. a race condition). | ||
98 | setTimeout(function() { | ||
99 | gdbar.classList.add('active'); | ||
100 | }, 5); | ||
101 | } else { | ||
102 | gdbar.classList.remove('active'); | ||
103 | } | ||
104 | } | ||
78 | }; | 105 | }; |
79 | 106 | ||
80 | /** | 107 | /** |