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. CSS hack用法案例詳解2. input submit、button和回車(chē)鍵提交數(shù)據(jù)詳解3. PHP字符串前后字符或空格刪除方法介紹4. 使用HttpClient消費(fèi)ASP.NET Web API服務(wù)案例5. Jsp+Servlet實(shí)現(xiàn)文件上傳下載 刪除上傳文件(三)6. 詳解盒子端CSS動(dòng)畫(huà)性能提升7. ASP.NET Core實(shí)現(xiàn)中間件的幾種方式8. ASP常用日期格式化函數(shù) FormatDate()9. 詳解瀏覽器的緩存機(jī)制10. JSP servlet實(shí)現(xiàn)文件上傳下載和刪除
