Skip to content Skip to sidebar Skip to footer

Foundation 6 Orbit: Change Slide Programatically

On Foundation 6. I have an orbit slider that, besides the default behaviour, it also needs to be able to change the slide when an outside button is clicked. Is there a way to make

Solution 1:

My solution as follow:

$('.orbit-external-control').on('click', function () {
  var activeIdx = ~~$('.orbit .orbit-bullets .is-active').data('slide')
  var changeIdx = ~~$(this).data('slide')
  var isLTR = (changeIdx > activeIdx) ? true : false

  if (activeIdx ===  changeIdx)
    return

  var chosenSlide = $('.orbit .orbit-slide').filter(function (index) {
    return index === changeIdx
  })

  $('.orbit').foundation('changeSlide', isLTR, chosenSlide, changeIdx) 
})

Post a Comment for "Foundation 6 Orbit: Change Slide Programatically"