Skip to content

Commit

Permalink
home carousel if arrows check
Browse files Browse the repository at this point in the history
  • Loading branch information
yurytut1993 committed Jul 31, 2020
1 parent 8e19b69 commit ac71d92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/js/theme/common/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const showCarouselIfSlidesAnalizedSetup = ($carousel) => {

const arrowAriaLabling = ($arrowLeft, $arrowRight, currentSlide, lastSlide) => {
if (lastSlide < 2) return;
if ($arrowLeft.length === 0 || $arrowRight.length === 0) return;

const arrowAriaLabelBaseText = $arrowLeft.attr('aria-label');

Expand Down
4 changes: 4 additions & 0 deletions templates/components/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"prevArrow": ".js-hero-prev-arrow",
"nextArrow": ".js-hero-next-arrow"
}'>
{{#if arrows}}
{{#if carousel.slides.length '>' 1}}
<button aria-label="{{lang 'carousel.arrowAriaLabel'}} {{carousel.slides.length}}" class="js-hero-prev-arrow slick-prev slick-arrow">hero-prev-arrow</button>
{{/if}}
{{/if}}
{{#each carousel.slides}}
<a class="hero-slide" href="{{url}}">
<div class="heroCarousel-slide {{#if ../theme_settings.homepage_stretch_carousel_images}}stretch{{/if}} {{#if @first}}heroCarousel-slide--first{{/if}}">
Expand Down Expand Up @@ -47,7 +49,9 @@
</div>
</a>
{{/each}}
{{#if arrows}}
{{#if carousel.slides.length '>' 1}}
<button aria-label="{{lang 'carousel.arrowAriaLabel'}} {{carousel.slides.length}}" class="js-hero-next-arrow slick-next slick-arrow">hero-next-arrow</button>
{{/if}}
{{/if}}
</section>

0 comments on commit ac71d92

Please sign in to comment.