내 이미지의 슬라이드 쇼를 만들려고 노력하면서 첫 번째 이미지 만 상쾌하게 유지됩니다. 어디서 잘못 볼 수 있습니까?슬라이드 쇼가 사라져 페이드 아웃
HTML :
<div id="slideshow">
<a href="#"><img src="http://placekitten.com/200/300" class="active"/></a>
<a href="#"><img src="http://placekitten.com/300/400"/></a>
<a href="#"><img src="http://placekitten.com/350/500"/></a>
<a href="#"><img src="http://placekitten.com/370/600"/></a>
</div>
jQuery를 : 당신이 당신의 $active
변수에 next()
을 사용하고 있기 때문에
function slideSwitch() {
var $active = $('#slideshow a IMG.active');
if ($active.length == 0) $active = $('#slideshow a IMG:last');
// use this to pull the images in the order they appear in the markup
var $next = $active.next().length ? $active.next() : $('#slideshow a IMG:first');
// uncomment the 3 lines below to pull the images in random order
// var $sibs = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length);
// var $next = $($sibs[ rndNum ]);
$active.addClass('last-active');
$next.css({
opacity: 0.0
}).addClass('active').animate({
opacity: 1.0
}, 1000, function() {
$active.removeClass('active last-active');
});
};
$(function() {
setInterval(slideSwitch, 5000);
});
앞으로, *** 여기 *** 당신의 코드를 게시 만 데모 목적을 위해 외부 사이트에 의존하십시오. 당신의 경우에 JS 피들 (Pied Fiddle)이 넘어져서 (다시 ...)이 질문은 아무런 목적도 달성하지 못했고 대답하기가 불가능했을 것입니다. –