




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
第js+css實(shí)現(xiàn)卡片輪播圖效果本文實(shí)例為大家分享了js+css實(shí)現(xiàn)卡片輪播圖效果的具體代碼,供大家參考,具體內(nèi)容如下
實(shí)現(xiàn)點(diǎn)擊的時(shí)候切換卡片,自動(dòng)輪播,鼠標(biāo)移入暫停,移出繼續(xù)輪播,有動(dòng)畫(huà)事件
效果就是這樣
下面是代碼
htmllang="en"
head
metacharset="UTF-8"
metahttp-equiv="X-UA-Compatible"content="IE=edge"
metaname="viewport"content="width=device-width,initial-scale=1.0"
titleDocument/title
style
.box{
width:680px;
padding:50px;
margin:auto;
margin-top:300px;
}
.swiper,
#swiper{
width:830px;
height:200px;
position:relative;
}
.swiperdiv{
display:block;
position:absolute;
width:500px;
height:200px;
overflow:hidden;
left:165px;
top:0;
transition:0.5s;
color:#fff;
font-size:50px;
text-align:center;
line-height:200px;
}
.swiperdiv:nth-child(1){
background:#1ebe09;
}
.swiperdiv:nth-child(2){
background:#323a31;
}
.swiperdiv:nth-child(3){
background:#0985be;
}
.swiperdiv:nth-child(4){
background:#090cbe;
}
.swiperdiv:nth-child(5){
background:#be5109;
}
.swiperdiv:nth-child(6){
background:#be09af;
}
.swiperdiv:nth-child(7){
background:#be8e09;
}
.swiperdiv:nth-child(8){
background:#be0909;
}
.swiperdiv:nth-child(9){
background:#06162c;
}
.swiper.a{
opacity:1;
z-index:23;
-webkit-transform:translateX(255px)translateZ(-300px)rotateY(-45deg);
-ms-transform:translateX(255px)translateZ(-300px)rotateY(-45deg);
transform:perspective(500px)translateX(300px)translateZ(-253px)rotateY(-45deg);
-webkit-box-reflect:below10px-webkit-gradient(linear,lefttop,leftbottom,from(transparent),color-stop(30%,transparent),to(rgba(250,250,250,0.3)));
}
.swiper.b{
opacity:1;
z-index:33;
-webkit-box-reflect:below10px-webkit-gradient(linear,lefttop,leftbottom,from(transparent),color-stop(30%,transparent),to(rgba(250,250,250,0.3)));
transform:translateX(0)translateZ(-100px)rotateY(0deg)
}
.swiper.c{
opacity:1;
z-index:23;
-webkit-box-reflect:below10px-webkit-gradient(linear,lefttop,leftbottom,from(transparent),color-stop(30%,transparent),to(rgba(250,250,250,0.3)));
-webkit-transform:translateX(255px)translateZ(-300px)rotateY(-45deg);
-ms-transform:translateX(255px)translateZ(-300px)rotateY(-45deg);
transform:perspective(500px)translateX(-300px)translateZ(-253px)rotateY(45deg);
}
.swiper.dd{
opacity:0;
z-index:-1;
-webkit-transform:translateX(0)translateZ(-300px)rotateY(0);
-ms-transform:translateX(0)translateZ(-300px)rotateY(0);
transform:perspective(500px)translateX(0)translateZ(-253px)rotateY(0);
}
/style
/head
body
div
divid="swiper"
div1/div
div2/div
div3/div
div4/div
div5/div
div6/div
div7/div
div8/div
div9/div
/div
/div
script
consttime=3000;
//自動(dòng)播放速度
varindex=0
//索引
constswiperitem=document.getElementById('swiper')//獲取父元素
constswiper=swiperitem.getElementsByTagName('div')//獲取合集
//
自動(dòng)輪播
varsetTime=setInterval(()={
if(indexswiper.length-1){
index++
}else{
index=0
}
style()
},time)
//點(diǎn)解切換
for(leti=0;iswiper.length;i++){
swiper[i].onclick=function(){
if(i===index)return
index=i
style()
}
}
//鼠標(biāo)移入暫停
swiperitem.onmouseover
=function(){
clearInterval(setTime)
}
//鼠標(biāo)移出繼續(xù)輪播
swiperitem.onmouseout
=function(){
setTime=setInterval(()={
if(indexswiper.length-1){
index++
}else{
index=0
}
style()
},time)
}
//滾動(dòng)事件
functionstyle(){
console.log(index)
for(leti=0;iswiper.length;i++){
swiper[i].className='swiper-timedd'
}
if(index===swiper.length-1){
swiper[index].className='swiper-timeb'
swiper[0].className='swiper-timea'
swiper[index-1].className='swiper-timec'
}elseif(index===0){
swiper[index].className='swiper-timeb'
swiper[index+1].className='swiper-timea'
swiper[swiper.length-1].className='swiper-timec'
}
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年中國(guó)綠色雞蛋行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025年棉滌彈力刮染布項(xiàng)目市場(chǎng)調(diào)查研究報(bào)告
- 智能感應(yīng)籃球?qū)Q企業(yè)制定與實(shí)施新質(zhì)生產(chǎn)力戰(zhàn)略研究報(bào)告
- 智能扭矩傳感器企業(yè)制定與實(shí)施新質(zhì)生產(chǎn)力戰(zhàn)略研究報(bào)告
- 智能搬運(yùn)小車行業(yè)深度調(diào)研及發(fā)展戰(zhàn)略咨詢報(bào)告
- 智能旅行音響行業(yè)深度調(diào)研及發(fā)展戰(zhàn)略咨詢報(bào)告
- 智能文具系統(tǒng)行業(yè)深度調(diào)研及發(fā)展戰(zhàn)略咨詢報(bào)告
- 皮質(zhì)甾類激素粉針劑企業(yè)ESG實(shí)踐與創(chuàng)新戰(zhàn)略研究報(bào)告
- 會(huì)計(jì)購(gòu)買服務(wù)合同范例
- 代理代發(fā)合同范例
- 鑄就數(shù)字堅(jiān)盾網(wǎng)絡(luò)安全技術(shù)知到課后答案智慧樹(shù)章節(jié)測(cè)試答案2025年春青島工學(xué)院
- (高清版)JTGT 3650-01-2022 公路橋梁施工監(jiān)控技術(shù)規(guī)程
- 中國(guó)歷史地理智慧樹(shù)知到期末考試答案章節(jié)答案2024年北京大學(xué)
- MOOC 跨文化交際通識(shí)通論-揚(yáng)州大學(xué) 中國(guó)大學(xué)慕課答案
- API520-安全閥計(jì)算PART1(中文版)
- 超聲引導(dǎo)下針刀精準(zhǔn)治療膝骨關(guān)節(jié)炎課件
- 常見(jiàn)典型心電圖診斷規(guī)培-課件
- 國(guó)內(nèi)旅客臨時(shí)住宿登記表格式
- 八年級(jí)期末質(zhì)量分析-課件
- 費(fèi)森4008s常見(jiàn)故障排除
- 積極心態(tài)與消極心態(tài)
評(píng)論
0/150
提交評(píng)論