Mostafa Elkady
Mostafa Elkady

Reputation: 5791

jquery carousel Control function

i have this plugin and it use different way to access, i spend two couples of hours trying to write a code to go to a specific item (index 5 for example), i have this code

var carouselNavigation = $('.carousel-navigation').jcarousel();

for

    <div class="connected-carousels">


        <div class="navigation">
            <a href="#" class="prev prev-navigation">&lsaquo;</a>
            <a href="#" class="next next-navigation">&rsaquo;</a>
            <div class="carousel carousel-navigation">
                <ul>
                    {foreach $objects as $object}
                        <li><img src="{get_photo details=$object size='xl'}" width="50" height="50" alt=""></li>
                    {/foreach}
                </ul>
            </div>
        </div>
    </div> 

now i want to go to index 5 directly by one function such as

carouselNavigation.goindex(5);

i'm tried

carouselNavigation.jcarousel().jcarouselControl({
        target: carouselNavigation.jcarousel('items').eq(5)
});

and not worked, then tried

carouselNavigation.jcarouselControl({
        target: carouselNavigation.jcarousel('items').eq(5)
});

not worked,then

jcarouselControl({
        target: carouselNavigation.jcarousel('items').eq(5)
});

Upvotes: 0

Views: 39

Answers (2)

dm4web
dm4web

Reputation: 4652

http://jsfiddle.net/p7bybqyp/

use scroll metod:

$('.jcarousel').jcarousel('scroll', 5);

Upvotes: 1

Tony
Tony

Reputation: 482

As jcarousel is a method on a jquery element, It seems you could be done by something like :

$('.carousel-navigation').jcarousel('items').eq(5);

I hope it may help

Upvotes: 1

Related Questions