开发者

jQuery Cycle with defined pager links

I built a player using cycle that cycles through various promos but I want to define the specific descriptive pager links for each page (other than 1,2,3, etc.) I know this should be possible but cannot figure out how... Even when I have added elements in the pager div they show up but the numbers that are auto generated are what controls the player. Thanks in advance for the help!

$(document).ready( function(){
  $('#promoPlayer').cycle({
    fx: 'fade',
    speed: 600,
    timeout: 6000,
 开发者_JAVA百科   delay: 1000,
    pager:'#pager'
  });
})


For this, you will want to use the callback function pagerAnchorBuilder for generating the Pager links.

You can return any html string from the function, and it receives the current slide as the first parameter. From there, you can create your own structure.

$(document).ready( function(){
  $('#promoPlayer').cycle({
    fx: 'fade',
    speed: 600,
    timeout: 6000,
    delay: 1000,
    pager:'#pager',

    // callback fn that creates a thumbnail to use as pager anchor 
    pagerAnchorBuilder: function(idx, slide) { 
    return '<li><a href="#">my custom link #'+ idx +'</a></li>'; 
} 
  });
})

A live exampe can be seen at http://jquery.malsup.com/cycle/pager2.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜