Change CSS based on Nivo Slider current image

余生颓废 提交于 2019-12-11 11:22:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!