第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

添加了動(dòng)畫函數(shù)后反而圖片無法切換了

<!DOCTYPE?html>
<html>
<head>
<meta?charset="UTF-8">
<title>Document</title>
<style?type="text/css">
*{
margin:?0;
padding:?0;
}
a{
text-decoration:?none;
}
li,ul{
list-style:?none;
}
#container{
margin:?20px;
width:?440px;
height:?220px;
border-bottom:?20px?solid?#000;
background:?#000;
position:?relative;
overflow:?hidden;

}
#list{
width:?3080px;
height:?220px;
z-index:?1;
position:?absolute;
}
#list?img{
float:?left;
}
.arrow{
width:?40px;
height:?40px;
line-height:?40px;
color:?#fff;
z-index:?2;
position:?absolute;
top:?90px;
background:?RGBA(0,0,0,.3);
text-align:?center;
font-size:?20px;
font-weight:?bold;
display:?none;
}
#container:hover?.arrow{
display:?block;
}
.arrow:hover{
background-color:?RGBA(0,0,0,.7);
}
#buttons{
width:?120px;
height:?15px;
position:?absolute;
bottom:?10px;
left:?170px;
z-index:?2;?
}
#buttons?li{
height:?15px;
width:?15px;
background:?#eee;
border:1px?solid?#999;
border-radius:?50%;
float:?left;
margin-left:?5px;
cursor:?pointer;
}
#buttons?.on{
background:?#DE752D;
}
#next{
right:?20px;
}
#prev{
left:?20px;
}
</style>
</head>
<body>
<div?id="container">
<div?id="list"?style="left:?-440px">
<img?src="5.jpg">
<img?src="1.jpg">
<img?src="2.jpg">
<img?src="3.jpg">
<img?src="4.jpg">
<img?src="5.jpg">
<img?src="1.jpg">
</div>
<ul?id="buttons">
<li?index="1"></li>
<li?index="2"></li>
<li?index="3"></li>
<li?index="4"></li>
<li?index="5"></li>
</ul>
<a?href="javascript:;"?id="prev">&lt;</a>
<a?href="javascript:;"?id="next">&gt;</a>
</div>
<script?type="text/javascript">
window.onload?=?function(){
var?container?=?document.getElementById('container');
var?list?=?document.getElementById('list');
var?prev?=?document.getElementById('prev');
var?next?=?document.getElementById('next');
var?buttons?=?document.getElementById('buttons').getElementsByTagName('li');
var?index?=?1;

function?showbutton(){
for?(var?i?=?0;?i?<?buttons.length;?i++)?{
if(buttons[i].className?==?'on'){
buttons[i].className?=?'';
}
}
buttons[index?-?1].className?='on';
}
function?animate(offset){
var?newleft?=?parseInt(list.style.left)?+?offset;
var?time?=?440;
var?inteval?=?10;
var?speed?=?offset/(time/inteval);

function?goto()?{
if?((speed?<?0?&&?parseInt(list.style.left)?>?newleft)?||?(speed?>?0?&&?parseInt(list.style.left)?<?newleft)){
list.style.left?=?parseInt(list.style.left)+speed+'px';
setTimeout(goto,?inteval);
}
else?{
list.style.left?=?parseInt(list.style.left)?+offset?+?'px';
if?(newleft?<?-2200){
list.style.left?=?-440?+?'px';
}
if?(newleft?>?-440){
list.style.left?=??-2200?+?'px';
}
}
}
debugger;
}
next.onclick?=?function(){
if?(index?==?5)?{
index?=1;
}?else?{
index?+=?1;
}
showbutton();
animate(-440);
}
prev.onclick?=?function(){
if?(index?==?1)?{
index?=5;
}?else?{
index?-=?1;
}
showbutton();
animate(440);
}
for?(var?i?=?0;?i?<?buttons.length;?i++)?{
buttons[i].onclick?=?function(){
var?myindex?=?parseInt(this.getAttribute('index'));
var?offset?=?-440?*?(myindex?-?index);
animate(offset);
index?=?myindex;
showbutton();
}
}
}
</script>
</body>
</html>


正在回答

2 回答

你沒有在goto()的函數(shù)里面調(diào)用自身也就是goto(),無法觸發(fā)setTimeout,所以函數(shù)動(dòng)畫無法實(shí)現(xiàn)。

0 回復(fù) 有任何疑惑可以回復(fù)我~

goto() 打上

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

litmonw 提問者

請問是哪一行的?
2016-06-01 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Sunnylincon 回復(fù) litmonw 提問者

他是說你創(chuàng)建了goto()而沒有調(diào)用它,在下面加個(gè)goto()就好啦
2016-06-10 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

添加了動(dòng)畫函數(shù)后反而圖片無法切換了

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)