0

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

$('#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>标签中,这会破坏缩略图。

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

4

1 回答 1

0

我能做到这一点的唯一方法是通过追溯地将图像包装在 a 标签中来做到这一点:

  $("#frontimageswap img:nth-child(1)").wrap("<a href='http://www.google.com' />");
于 2013-06-03T02:57:26.447 回答