开发者

How to get the active index in easySlider?

开发者 https://www.devze.com 2023-04-13 01:38 出处:网络
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 inde

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

精彩评论

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