vue實(shí)現(xiàn)點(diǎn)擊翻轉(zhuǎn)效果
用vue簡(jiǎn)單實(shí)現(xiàn)一個(gè)點(diǎn)擊翻轉(zhuǎn)的效果,供大家參考,具體內(nèi)容如下
1、
2、
3、
//html代碼 測(cè)試 demo命名隨便復(fù)制來(lái)的<div class='Demo'><div : @click='handleBefore'></div><div : @click='handleAfter' style='font-size:20px;color:black'>這個(gè)是背面內(nèi)容</div> </div>//在data中定義isTop:false//methods中的方法handleBefore(){ if(!this.isTop){ this.isTop = true } }, handleAfter(){ if(this.isTop){ this.isTop = false } }
//css.Demo{ width: 375px; height: 300px; margin-top: 50px; /* margin-left: 500px; */ position: relative; perspective: 800px; box-sizing: border-box;}.Before{ width: 100px; height: 200px; position: absolute; top:0; left: 0; background-repeat: no-repeat; background-position: center center; backface-visibility: hidden; transition: 1.5s; background-image:url(’../assets/images/chunfen4.jpg’); border:1px solid yellow; }.After{ width: 100px; height: 200px; position: absolute; top:0; left: 0; color: #fff; background-color:#fff; text-indent: 2em; transform: rotateY(-180deg); backface-visibility: hidden; transition: 1.5s; border:1px solid yellow;}.Demo .contain-Before{ transform: rotateY(180deg);}.Demo .contain-After{ transform: rotateY(0deg);}
大功告成,如果想要滑過(guò)翻轉(zhuǎn)的話自行去掉事件,給div添加 :hover 方法
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. Python如何批量生成和調(diào)用變量2. windows服務(wù)器使用IIS時(shí)thinkphp搜索中文無(wú)效問(wèn)題3. Python基于requests實(shí)現(xiàn)模擬上傳文件4. python利用opencv實(shí)現(xiàn)顏色檢測(cè)5. Python sorted排序方法如何實(shí)現(xiàn)6. Python 中如何使用 virtualenv 管理虛擬環(huán)境7. 通過(guò)CSS數(shù)學(xué)函數(shù)實(shí)現(xiàn)動(dòng)畫(huà)特效8. ASP.NET MVC實(shí)現(xiàn)橫向展示購(gòu)物車9. ASP.Net Core(C#)創(chuàng)建Web站點(diǎn)的實(shí)現(xiàn)10. Python獲取B站粉絲數(shù)的示例代碼
