Skip to content

Commit

Permalink
Hide type="carousel" arrows after swiping to a new slide. (ampproject…
Browse files Browse the repository at this point in the history
…#25010)

Prior to this change, the carousel arrows would never hide for
amp-carousel 0.2, regardless of the controls attribute.
  • Loading branch information
Sepand Parhami authored and Micajuine Ho committed Dec 27, 2019
1 parent ea72489 commit 4fbc75f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions extensions/amp-carousel/0.2/amp-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,17 +625,19 @@ class AmpCarousel extends AMP.BaseElement {
* @param {!Event} event
*/
onIndexChanged_(event) {
if (this.type_ == CarouselType.CAROUSEL) {
return;
}

const detail = getDetail(event);
const index = detail['index'];
const actionSource = detail['actionSource'];

this.hadTouch_ = this.hadTouch_ || actionSource == ActionSource.TOUCH;
this.updateCurrentIndex_(index, actionSource);
this.updateUi_();

// Do not fire events, analytics for type="carousel".
if (this.type_ == CarouselType.CAROUSEL) {
return;
}

this.updateCurrentIndex_(index, actionSource);
}
}

Expand Down

0 comments on commit 4fbc75f

Please sign in to comment.