最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Get current index of jCarouselLite imagepage - Stack Overflow

programmeradmin1浏览0评论

I've looked through the other questions about this and not found a suitable answer.

What I need is very simple: The index of the currently shown item.

Here's my little chunk of config

    $('.carousel').jCarouselLite(
    { 
        btnNext: "#right-navigation",
        btnPrev: "#left-navigation",
        visible: 1,
        afterEnd: function(a)
        {
            // Code that requires the index
        }
    });

Note: the a is an object

Thanks!

I've looked through the other questions about this and not found a suitable answer.

What I need is very simple: The index of the currently shown item.

Here's my little chunk of config

    $('.carousel').jCarouselLite(
    { 
        btnNext: "#right-navigation",
        btnPrev: "#left-navigation",
        visible: 1,
        afterEnd: function(a)
        {
            // Code that requires the index
        }
    });

Note: the a is an object

Thanks!

Share Improve this question edited Jun 8, 2011 at 13:39 Alex asked Jun 8, 2011 at 13:30 AlexAlex 8,6829 gold badges46 silver badges58 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

The elements representing the items that are visible after the animation ends are passed in as argument.

so you should be able to do something like

afterEnd: function(a){
   var index = $(a[0]).index();
}

to get the index of the first element

发布评论

评论列表(0)

  1. 暂无评论