Я застрял, получая несколько слайд-шоу Cycle (с миниатюрами) для работы в моем блоге .... все миниатюры слайд-шоу нацелены на первый экземпляр слайд-шоу на странице, а подписи одинаковы на всехСлайд-шоу.
Добавили var p = this.parentNode
, но не знаете, как передать его функциям onAfter и pagerFactory?
Спасибо:)
// Setup cm_cycle_slideshow for each div.slideshow
var $ = jQuery.noConflict();
$('.slideshow #main').each(function(){
var p = this.parentNode;
$(this).cycle({
fx: 'fade',
speed: 500,
before: onAfter,
pager: $('#thumbs', p),
pagerAnchorBuilder: pagerFactory
}).cycle('pause');
});
function onAfter(curr, next, opts, fwd){
// Update the slide caption
$('#caption').html(this.alt);
// Get the height of the current slide
var $ht = $(this).height();
// Set the container's height to that of the current slide
$(this).parent().css("height", $ht);
}
function pagerFactory(idx, slide) {
return '.slideshow #thumbs span:eq(' + idx + ') a';
}
И HTML...
<div class="slideshow">
<div id="main">
<img width="470" height="313" src="blahblahblah.jpg" class="attachment-medium" alt="Camilla Meijer cushions" title="Camilla Meijer cushions" style="position: absolute; top: 0px; left: 0px; z-index: 4; opacity: 0; display: none; ">
<img width="470" height="313" src="blahblahblah.jpg" class="attachment-medium" alt="Camilla Meijer cushions" title="Camilla Meijer cushions" style="position: absolute; top: 0px; left: 0px; z-index: 4; opacity: 0; display: none; ">
<img width="470" height="313" src="blahblahblah.jpg" class="attachment-medium" alt="Camilla Meijer cushions" title="Camilla Meijer cushions" style="position: absolute; top: 0px; left: 0px; z-index: 4; opacity: 0; display: none; ">
</div>
<div id="thumbs">
<span class=""><a href="#"><img width="74" height="74" src="blahblahblah.jpg" class="attachment-shop_thumbnail" alt="Caption here"></a></span>
<span class=""><a href="#"><img width="74" height="74" src="blahblahblah.jpg" class="attachment-shop_thumbnail" alt="Caption here"></a></span>
<span class=""><a href="#"><img width="74" height="74" src="blahblahblah.jpg" class="attachment-shop_thumbnail" alt="Caption here"></a></span>
<div id="caption">Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing.</div>
</div>
</div>