开发者

Access param in the callback of jQuery Nivo Slider plugin

HI,

I'm using the Nivo Slider, a jQuery plugin allowing to create slideshow. He's perfect but I've just a little problem. Each pictures have an id (or another element like rel for example) and I would like to give this parameter in the callback function of Nivo (beforeChange: function(){}).

But the problem, in this beforeChange callback I cannot receive any param开发者_StackOverflow so I don't know witch image is changed.

Thanks !


You can access the nivo slider (where 'slider' is the id of the slider) object by using this function:

beforeChange: function(element){
  console.log($('#slider').data('nivo:vars'));  // Get the nivo vars
  console.log($('#slider').data('nivo:vars').currentSlide);  // Get current Slide
}

You can see the object in the console log of Chrome or Firefox.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜