0
타이머가 지나면 다음 사진으로 전환하는 대신 이미지 div가 비어있게됩니다. 무기한자바 스크립트 이미지 cycler
$('.carouselImageJavascriptActive').removeClass('carouselImageJavascriptActive');
$(this).addClass('carouselImageJavascriptActive');
var imgs=$(this).attr('.carouselImage')
var self = $(this);
var myImage = new Array();
var x=0;
myImage[0]='img/image1.jpg';
myImage[1]='img/image2.jpg';
myImage[2]='img/image3.jpg';
myImage[3]='img/image4.jpg';
setTimeout(function() {
var img = document.getElementById('.carouselImageJavascriptActive');
img.src = myImage[x];
x++;
if(x >= myImage.length){
x = 0;
}
},2000);
HTML 그 이미지의
<div id='challengeTwoImageJavascript' class='sectionChallengeCarouselImage'>
<img id='imgj1' imgn='1' class='carouselImage carouselImageJavascriptActive' src='img/image1.jpg'/>
<img id='imgj2' imgn='2' class='carouselImage' src='img/image2.jpg'/>
<img id='imgj3' imgn='3' class='carouselImage' src='img/image3.jpg'/>
<img id='imgj4' imgn='4'class='carouselImage' src='img/image4.jpg'/>
</div>
그가 jquery 클래스 선택기를 잘못된 장소에서 사용하고있는 것은 말할 것도없이. – Daedalus
나는이 시간에 정교 할 충분한 시간이 없으므로 아마도이 질문에 대답해서는 안된다. 누군가가 그때까지 대답하지 않으면 2 시간 후에 다시 연락 드리겠습니다. –
document.getElementByClassName으로 변경했습니다. 아직도 작동하지 않습니다. 생각해? – user1489691