1

I'm using the Siema carousel on my site with Zepto. I'd like to be able to indicate what slide the user is currently on. How do I do this if there is only an onChange event available?

HTML

<section class="images">
   <img/>
   <img/>
</section>

<section class="indicators">
   <span class="active"></span>
   <span></span>
</section>

JS

$(document).ready(function() {
  new Siema({
    selector: '.images',
    onChange: () => {
      console.log("swiped");
      // change active indicator?
    },
  });
});
1
  • Look under the API section of Siema carousel for current slide. This should have an example of the behavior you are looking for.
    – Joffutt4
    Commented Oct 24, 2017 at 15:08

1 Answer 1

3

I think I can help (I'm the author of Siema).

// extend a Siema class and add addDots() & updateDots() methods
const mySiemaWithDots = new SiemaWithDots({

  // on init trigger method created above
  onInit: function(){
    this.addDots();
    this.updateDots();
  },

  // on change trigger method created above
  onChange: function(){
    this.updateDots()
  },

});

https://codepen.io/pawelgrzybek/pen/boQQWy

Have a lovely day 🥑

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.