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

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

無(wú)法實(shí)現(xiàn)輪播

這是報(bào)錯(cuò)信息:

http://img1.sycdn.imooc.com//5e6277f10001170c05760165.jpg

這是代碼:

<script>

????$(()=>{

????????console.log('頁(yè)面元素加載完執(zhí)行');

????????var?outerWidth?=?600,

????????????outerHeight?=?400,

????????????speed?=?3,

????????????transitionTime?=?0.3,

????????????initIndex?=?0,

????????????setTimeId?=?null;

????????var?$marquee=$('.marquee');

????????var?$content=$marquee.find('.content');

????????var?$list=$content.find('.list');

????????var?listLength?=?$list.length;//list的長(zhǎng)度之和就是content的寬度

????????var?contentWidth?=?outerWidth*listLength;//outerWidth就是之前所設(shè)置的list的寬度

????????var?style?=?document.styleSheets;//獲得頁(yè)面加載的樣式表

????????$marquee.css({

????????????"width":`${outerWidth}px`,

????????????"height":`${outerHeight}px`

????????});

????????$list.css({//content需要list來(lái)算

????????????"width":`${outerWidth}px`,

????????????"height":`${outerHeight}px`

????????});

????????$content.css({//content需要list來(lái)算

????????????"width":`${contentWidth}px`,

????????????"height":`${outerHeight}px`,

????????????//?"animation":`run?${speed*listLength}s?linear?infinite`

????????});

????????var?clone?=?$list.eq(0).clone();//選擇list列表里的第一個(gè)元素把它克隆下來(lái)放到content里面

????????$content.append(clone);

????????function?autoPlay(){

????????????initIndex++;

????????????//setTimeId鼠標(biāo)移動(dòng)上去就停止輪播

????????????setTimeId?=?setInterval(()=>{

????????????????$content.css({

????????????????????"transition":`transform?${transitionTime}s?ease`,

????????????????????"transform":`translateX(-${outerWidth*initIndex})`

????????????????})

????????????},speed*1000)

????????}

????????autoPlay()

????})


</script>

求指教

正在回答

1 回答

嘗試一下在setInterval里打印一下outerWidth*initIndex是怎么變化的

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

舉報(bào)

0/150
提交
取消
帶你走入前端動(dòng)畫的世界
  • 參與學(xué)習(xí)       29782    人
  • 解答問(wèn)題       65    個(gè)

學(xué)習(xí)css3動(dòng)畫,并結(jié)合實(shí)際項(xiàng)目向大家展示應(yīng)用技巧,使大家快速入門。

進(jìn)入課程

無(wú)法實(shí)現(xiàn)輪播

我要回答 關(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)