问题
I'm using Nivo Slider to display a collection of 20 portfolio images on a wordpress-based site. Each image falls into a category that is reflected in my navigation: web, print, identity, packaging. I'd like to change the CSS on my navigation to reflect which category the current image falls into.
In Pseudo code:
On image change
If currentImage == 1 or 2 or 3 or 4
Then nav css = X
If currentImage == 5 or 6
Then nav css = Y
Thanks for the ideas - afterChange() and jQuery .addClass() look promising, but I'm having trouble referencing the correct variables.
afterChange: function(){
var slidecm = jQuery('#nivo-slider').data('nivo:vars').currentSlide;
alert(slidecm);
},
gives me an error "cannot read property currentSlide"
Any ideas?
来源:https://stackoverflow.com/questions/7947308/change-css-based-on-nivo-slider-current-image