开发者

How to get the active index in easySlider?

I'm using easySlider to create a slide show. but apparently it does not have a callback function or method to get the active index from it. Is there a way I can determine th开发者_JS百科e active index from anywhere else ? if not how can I add this functionality to this plugin ? I'm not good at jQuery. any help is really appreciated.


To get the current index without modifying the plugin code, you can use something like this:

var slider = $('#slider'),
    curIndex = Math.round(Math.abs(  parseInt(slider.find('ul').css('marginLeft')) / slider.width()  ));

To listen for the current index, you would need to modify the plugin code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜