Skip to content

Commit

Permalink
Fix for amp-base-carousel next arrow not hidden when visibleCount > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjs75 committed Sep 8, 2020
1 parent 63848d3 commit c7506dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion extensions/amp-base-carousel/0.1/amp-base-carousel.js
Expand Up @@ -537,14 +537,15 @@ class AmpCarousel extends AMP.BaseElement {
updateUi_() {
const index = this.carousel_.getCurrentIndex();
const loop = this.carousel_.isLooping();
const visibleCount = this.carousel_.getVisibleCount();
// TODO(sparhami) for Shadow DOM, we will need to get the assigned nodes
// instead.
iterateCursor(this.prevArrowSlot_.children, (child) => {
const disabled = !loop && index === 0;
toggleAttribute(child, 'disabled', disabled);
});
iterateCursor(this.nextArrowSlot_.children, (child) => {
const disabled = !loop && index === this.slides_.length - 1;
const disabled = !loop && index >= this.slides_.length - visibleCount;
toggleAttribute(child, 'disabled', disabled);
});
toggleAttribute(
Expand Down

0 comments on commit c7506dc

Please sign in to comment.