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

Unified Diff: chrome/browser/resources/ntp4/card_slider.js

Issue 7670073: ntp4: disable animations for pages that are off screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/ntp4/new_tab.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/card_slider.js
diff --git a/chrome/browser/resources/ntp4/card_slider.js b/chrome/browser/resources/ntp4/card_slider.js
index 0cd671119532bca94149892b8c09b87cd8354848..ca18f4e90ae2304197ebc0a50263abdc9ae122ee 100644
--- a/chrome/browser/resources/ntp4/card_slider.js
+++ b/chrome/browser/resources/ntp4/card_slider.js
@@ -263,13 +263,15 @@ var CardSlider = (function() {
* current position to new position.
*/
selectCard: function(newCardIndex, opt_animate) {
- var isChangingCard = newCardIndex >= 0 &&
- newCardIndex < this.cards_.length &&
- newCardIndex != this.currentCard;
+ var isChangingCard =
+ !this.cards_[newCardIndex].classList.contains('selected-card');
+
if (isChangingCard) {
+ this.currentCardValue.classList.remove('selected-card');
// If we have a new card index and it is valid then update the left
// position and current card index.
this.currentCard_ = newCardIndex;
+ this.currentCardValue.classList.add('selected-card');
}
this.transformToCurrentCard_(opt_animate);
« no previous file with comments | « no previous file | chrome/browser/resources/ntp4/new_tab.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698