The current method I use simply increments an index value on afterChange event, but this breaks when the user navigates backwards. How can I determine what the current image index is?
(function($){ $(function(){
var i = 0
var swapColor = function(){
var index = i++ % $("#slider img").length // gets the calculated index according to hom many times the slider has swapped slides
var color = $("#slider img").eq(index).data('color')
$(".nivo-caption, .nivo-html-caption").css({backgroundColor: color})
}
$('#slider').nivoSlider({
afterLoad: swapColor,
beforeChange: swapColor
});
}) })(jQuery);
I did it using this method...
var index = $(".nivo-controlNav .active").attr('rel')
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