Skip to content

Commit

Permalink
Fall back to loop:false if only one slide
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cetinkaya committed Jun 19, 2019
1 parent 4ea1f86 commit c9a131f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export function EmblaCarousel(
slides.forEach(slideFocusEvent)
slider.translate.to(slider.mover.location)

if (options.loop && slides.length === 1) {
return activate({ loop: false })
}

if (options.draggable) activateDragFeature()
if (options.loop) slider.shifter.shiftInfinite(slides)
if (isFirstInit) {
Expand Down

0 comments on commit c9a131f

Please sign in to comment.