Skip to content

Commit

Permalink
Make use of new API methods on demo page
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cetinkaya committed Jun 16, 2019
1 parent 52bd86e commit 3d6d78f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,14 @@ <h2 class="banner__subheading">
}

function togglePrevAndNextBtns(prevBtn, nextBtn, embla) {
var min = 0
var max = embla.groupedIndexes().length - 1
return function() {
var selected = embla.selectedIndex()
var previous = embla.previousIndex()
if (previous === min) prevBtn.removeAttribute('disabled')
if (selected === min)
if (embla.hasPreviousIndex())
prevBtn.removeAttribute('disabled')
if (embla.isFirstIndex())
prevBtn.setAttribute('disabled', 'disabled')
if (previous === max) nextBtn.removeAttribute('disabled')
if (selected === max)
if (embla.hasNextIndex())
nextBtn.removeAttribute('disabled')
if (embla.isLastIndex())
nextBtn.setAttribute('disabled', 'disabled')
}
}
Expand Down

0 comments on commit 3d6d78f

Please sign in to comment.