0

次のマークアップを使用して、jquery サイクルのスライドショーをセットアップしています。ただし、別の画像 src でサムネイルを実装する方法を理解したいと思います。拡大画像の src が image-file-name.jpg の場合、src th-image-file-name.jpg でサムネイルを呼び出すにはどうすればよいですか?

    <script type="text/javascript">
$(document).ready(function() {
$('#s2').cycle({ 
fx:     'fade', 
speed:  'slow', 
timeout: 0, 
next:   '#next', 
prev:   '#prev', 
pager:  '#thumbs',
after: onAfter,

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

 });


 function onAfter(curr, next, opts, fwd) {
 var index = opts.currSlide;
 //$('#prev')[index == 0 ? 'hide' : 'show']();
 //$('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
//get the height of the current slide
var $ht = $(this).height();
//set the container's height to that of the current slide
$(this).parent().animate({height: $ht});
}
});
    </script>
4

1 に答える 1

0

このチュートリアルは、あなたが探しているものを達成するのに役立つと信じています:チュートリアル

これがデモです:デモ

于 2012-01-07T21:56:11.193 に答える