문제

I am using the Jquery cycle plugin (http://malsup.com/jquery/cycle/) on a blog listing page. There are multiple slideshows which work fine but I'd like each on the have their own previous and next.

Because these are blog posts it is difficult to sign unique IDs or classes. I currently have:-

    $('.article .gallery').cycle({
 next: '.viewmore .left',
 prev: '.viewmore .right',
timeout:0
});

I have tried the following but doesn't work. It gives you a better idea of what I am looking for:-

 $('.article .gallery').cycle({
 next: $(this).next('.viewmore .left'),
 prev: $(this).next('.viewmore .right'),
timeout:0
});

Can anyone help me? Thanks in advance.

Dave.

도움이 되었습니까?

해결책

Try something like this:

$('.article .gallery').each(function(){
    var $this = $(this);
    $this.cycle({
        next: $this.next('.viewmore').find('.left'),
        prev: $this.next('.viewmore').find('.right')
    });
});

다른 팁

can you use entry ids in the classes/ids?

something like:

<span id="prev_{entry_id}">Previous</span>
<span id="next_{entry_id}">Next</span>

then put that portion of the javascript inline.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top