나는이 같은 배너 광고를 복제하려고하지만 애니메이션 GIF 세 개를 반복해야합니다.gif를 통한 반복
// randomization
var index = Math.floor(Math.random() * 3);
var images = new Array("<div class='ad'><a href = 'https://www.poundstopocket.co.uk/buildapp' target='_blank'>
<img src='https://www.poundstopocket.co.uk/pound-place/wp-content/themes/shaken-grid-premium/images/1.gif' alt='Visit Computer Hope'></a></div>",
"<div class='ad'><a href = 'https://www.poundstopocket.co.uk/straightforwardapp' target='_blank'><img src='https://www.poundstopocket.co.uk/pound-place/wp-content/themes/shaken-grid-premium/images/2.gif' alt='Computer History'></a></div>",
"<div class='ad'><a href = 'https://www.poundstopocket.co.uk/nohiddenfeesapp' target='_blank'><img src='https://www.poundstopocket.co.uk/pound-place/wp-content/themes/shaken-grid-premium/images/3.gif' alt='Visit Computer Hope'></a></div>")
// loop
setInterval(function() {
$('.ad').html(images[index])
if(index == 2){
index = 0;
}else{
index++;
}
}, 5000);
의 JScript와 웹 사이트에서 이미지의 대부분을 포함 : 여기
내가 여기 수정 된 샘플 코드입니다.이 루프는 내 자신의 목적을 위해 필요한 것처럼 작동하지 않습니다. 루프를 재설정하고 0,1, 2에서 다시 시작해야합니다. 무작위로 초기 스크립트를 작성 했으므로 그 부분을 계속 유지하고 싶습니다. 3 5 또는 6 초 gif.
, 당신이 당신의 HTML의 DIV를 넣어 시도하고'페이드 아웃()'및'fadeIn()'플레이 했습니까? –
감사합니다 이것은
입니다. 루프가 먼저 작동하기를 원했기 때문에 페이드 인/아웃을 시도하지 않았으며 여기서는 보이지 않습니다. http://jsfiddle.net/2ZgG3/1/ – amarama