/gist:a7b24018528bbc06874b Secret
Last active
December 16, 2015 09:09
RoyalSlider creating 1 of X indicator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
var createIndicator = function() { | |
var sliderEL = $('.royalSlider'); // your slider selector | |
var slideCountEl = $('<div class="rsSlideCount"></div>').appendTo(sliderEL ); // append counter element somewhere | |
var slider = sliderEL.data('royalSlider'); | |
var updCount = function() { | |
slideCountEl.html( (slider.currSlideId+1) + ' of ' + slider.numSlides ); | |
}; | |
slider.ev.on('rsAfterSlideChange', updCount); | |
updCount(); | |
}; | |
setTimeout(function() { | |
createIndicator(); | |
}, 1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment