亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

輪番圖出現的問題

為什么代碼和老師敲的一點擊箭頭圖片老是第一張

正在回答

2 回答

如果錯誤都找出來,證明你學會了,其它可以從別人的代碼中找錯誤也是一種學習方法。

iyffvpigriqbarlqakdewmxfiymxiwovdtwwubmgynjjpcqwdiicbqsfsqlzsbrlezzxcfwaoebfylafeidsphyvolkchkdyjresyuhvsbkhvsuzffyxgmlxzxhli

0 回復 有任何疑惑可以回復我~

window.onload=function ?() {

var container =document.getElementById("container");

var list=document.getElementById("list");

var buttons=document.getElementById("buttons").getElementsByTagName("span");

var prev=document.getElementById("prev");

var next=document.getElementById("next");

var index=1;

var animated =false;


function showb() {

for (var i = 0; i <buttons.length; i++) {

if (buttons[i].className=="on"){

buttons[i].className="";

break;

}

}

buttons[index -1].className ="on";

}


function animate(offset) {

animated=true;

var news=parseInt(list.style.left)+offset;

var time=300; ? //總時間

var interval =10; //間隔時間

var speed=offset/(time/interval);


function go() {

if ((speed < 0 && parseInt(list.style.left)>news) || ?(speed>0 && parseInt(list.style.left)<news)) {

list.style.left=parseInt(list.style.left)+speed+"px";

setTimeout(go,interval);

// statement

}

else{

animated=false;

list.style.left =news+"px";

if (news>-600) {

list.style.left=-3000+"px";

}

if (news<-3000 ){

list.style.left=-600+"px";

}

}

}

go();

}

next.onclick=function () {

if (index==5) {

index=1;

}

else {

index+=1;

}

showb();

if (!animated) {

animate(-600);

}

}

prev.onclick=function () {

if (index==1) {

index=5;

}

else {

index-=1;

}

showb();

if (!animated) {

animate(600);

}

}

for (var i = 0; i < buttons.length; i++) {

? ? ? ? ? ? ? ? buttons[i].onclick = function () {

? ? ? ? ? ? ? ? ? ? if (animate) {

? ? ? ? ? ? ? ? ? ? ? ? return;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? if(this.className == 'on') {

? ? ? ? ? ? ? ? ? ? ? ? return;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? var myIndex = parseInt(this.getAttribute('index'));

? ? ? ? ? ? ? ? ? ? var offset = -600 * (myIndex - index);

? ? ? ? ? ? ? ? ? ? showb();

? ? ? ? ? ? ? ? ? ? if (!animated) {

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ? ? animate(offset);

? ? ? ? ? ? ? ? ? ? index = myIndex;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? }


}

}


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
焦點圖輪播特效
  • 參與學習       65332    人
  • 解答問題       638    個

通過本教程學習您將能掌握非常實用的焦點圖輪播特效的制作過程

進入課程

輪番圖出現的問題

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號