开发者

Jquery Cycle go to

I'm trying to make this work dynamically on click but for some reason with a variable in there it doesn't work and just says

[cycle] unknown transition: 1 ; slideshow terminating
[cycle] unknown transition: 2 ; slideshow terminating 

but works totally fine if I just use 1 or 2.

$('.go-to-issue').click(function() { 
   $('#wrap').cycle($(this)开发者_运维百科.attr('rel')); 
   return false; 
});

<a href="#" class="go-to-issue" rel="1">Click</a>


you probably need to convert it to an int, try $('#wrap').cycle(parseInt($(this).attr('rel')) - 1) (the -1 because first slide is 0 I think)


It helped me

$('#carouselnav span').click(function() {
    $('#scrollable').cycle(parseInt($(this).attr('rel')));
    $('#handles4 span').removeClass('active');
    $(this).addClass('active');
    return false;
});


Take a look at the Pager example: http://jquery.malsup.com/cycle/pager2.html

The pager features takes the user to a specific image in the cycle, which is what you want to do.

However, you might only want to implement a single pager link, not a link for each image in the cycle.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜