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

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

跟著敲不一樣。。。

誰(shuí)有完整的代碼,跟著敲為什么會(huì)有那么大的差異?

正在回答

1 回答


window.onload=function(){

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

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

var buttons=document.getElementById('button').getElementsByTagName('span');

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

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

var index=1;?

var animated=false;



? ? //按鈕高亮



? ? function showButton(){

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

? ? buttons[i].className='';

? ? }

? ? buttons[index-1].className='on';

? ? }

? ? //驅(qū)動(dòng)left的變化,切換圖片

? ? function animate(offset){

? ? animated=true;

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

? ? ? ? var time=200;//位移總時(shí)間

? ? ? ? var interval=10;//位移間隔時(shí)間

? ? ? ? var speed =offset/(time/interval);//每次位移量


? ? ? ? //位移之前的判斷函數(shù),是否位移

? ? ? ? function go(){

? ? ? ? //向左移動(dòng)&&獲取值大于目標(biāo)值

? ? ? ? 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(go,interval);

? ? ? ? }else{

? ? ? ? animated=false;

? ? ? ? list.style.left=newLeft+'px';

? ? ? ? if (newLeft>-600) {

? ? ? ? list.style.left=-3000+'px';

? ? ? ? }

? ? ? ? if(newLeft<-3000){

? ? ? ? list.style.left=-600+'px';

? ? ? ? }

? ? ? ? }

? ? ? ? }?

? ? ? ? go();

? ? }?

? ? ? ? //右按鈕單擊

? ? ? ? next.onclick=function(){

? ? ? ? if (index==5) {

? ? ? ? index=1;

? ? ? ? }else{

? ? ? ? index+=1;

? ? ? ? }? ? ?

? ? ? ? showButton();

? ? ? ? if (!animated) {

? ? ? ? ? animate(-600);

? ? ? ? }

? ? ? ? }

? ? ? ? //左按鈕單擊

? ? ? ? prev.onclick=function(){

? ? ? ? if (index==1) {

? ? ? ? index=5

? ? ? ? }else{

? ? ? ? index-=1;

? ? ? ? }

? ? ? ? showButton();

? ? ? ? if (!animated) {

? ? ? ? animate(+600);

? ? ? ? }? ? ?

? ? ? ? }

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

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

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

? ? ? ? return;

? ? ? ? }

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

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

? ? ? ? index = myIndex;

? ? ? ? showButton();

? ? ? ? if (!animated) {

? ? ? ? animate(offset);

? ? ? ? }


? ? ? ? }

? ? ? ? }




? ? }


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

舉報(bào)

0/150
提交
取消

跟著敲不一樣。。。

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

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

幫助反饋 APP下載

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

公眾號(hào)

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