Jquery Cycle Pager缩略图图像 - 保留主图像链接标签

时间:2013-05-31 01:40:24

标签: javascript jquery jquery-plugins jquery-cycle

我正在使用Jquery Cycle插件here,它使用滑块上的图像创建缩略图,例如:

$('#slideshow').before('<ul id="nav">').cycle({ 
    fx:     'turnDown', 
    speed:  'fast', 
    timeout: 0, 
    pager:  '#nav', 

    // callback fn that creates a thumbnail to use as pager anchor 
    pagerAnchorBuilder: function(idx, slide) { 
        return '<li><a href="#"><img src="' + slide.src + '" width="50" height="50" /></a></li>'; 
    } 
});

这将获取slide.src中的任何元素并将其转换为上传图像缩略图。但是,我想将我的滑动图像作为链接。但是,如果我要将它们包装在<a>标签中,则会破坏缩略图。

有人知道如何更改此脚本以允许标记吗?

1 个答案:

答案 0 :(得分:0)

我能实现这一目标的唯一方法是通过追溯性地将图像包装在标签中来实现:

  $("#frontimageswap img:nth-child(1)").wrap("<a href='http://www.google.com' />");
相关问题