I am currently working with orbit.js slider in Foundation 6 and not seeing an option to display slide number.
Could you advice me on this or share examples please.
Thanks!
Here's an example using jQuery that will change the innerHTML
propery of an element with the class .slide-number
to the active slide number, and log the active slide number to the console every time the slide changes.
function slideNumber() {
var $slides = $('.orbit-slide');
var $activeSlide = $slides.filter('.is-active');
var activeNum = $slides.index($activeSlide) + 1;
$('.slide-number').innerHTML = activeNum;
console.log(activeNum);
}
$('[data-orbit]').on('slidechange.zf.orbit', slideNumber);
Credit: I came up with this answer with the help of this SO post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With