新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
CSS實(shí)現(xiàn)菜單按鈕動(dòng)畫(huà)的案例-創(chuàng)新互聯(lián)
小編給大家分享一下CSS實(shí)現(xiàn)菜單按鈕動(dòng)畫(huà)的案例,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
要寫(xiě)一個(gè)下拉菜單點(diǎn)擊按鈕 菜單入口就是是點(diǎn)擊一個(gè)圖標(biāo)按鈕 之前都是隨便用個(gè)圖片代替 今天突然想用CSS寫(xiě)個(gè)效果 主要參考澎湃移動(dòng)端右上角的按鈕
效果:
HTML
//vue 中通過(guò)點(diǎn)擊事件改變class
CSS
.burger { cursor: pointer; display: inline-block; margin: 7px 6px 0 0; outline: none; } .burger p { width: 30px; height: 4px; margin-bottom: 6px; background-color: rgb(51, 51, 51); transform: rotate3d(0, 0, 0, 0); } .burger.transform p { background-color: transparent; } .burger.transform p:first-of-type { top: 10px; transform: rotate3d(0, 0, 1, 45deg) } .burger.transform p:last-of-type { bottom: 10px; transform: rotate3d(0, 0, 1, -45deg) } .burger.transform p:first-of-type, .burger.transform p:last-of-type { transition: transform .4s .3s ease, background-color 250ms ease-in; background: #00c1de; } .burger p:first-of-type, .burger p:last-of-type { transition: transform .3s ease .0s, background-color 0ms ease-out; position: relative; }
只用transition也是能達(dá)到 animation的效果的 通過(guò)設(shè)置不同屬性的變化 掌握好變化時(shí)間 和延時(shí)的時(shí)間 就可以讓動(dòng)畫(huà)有先后順序
以上是CSS實(shí)現(xiàn)菜單按鈕動(dòng)畫(huà)的案例的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道!
本文標(biāo)題:CSS實(shí)現(xiàn)菜單按鈕動(dòng)畫(huà)的案例-創(chuàng)新互聯(lián)
分享地址:http://www.ef60e0e.cn/article/dgccgh.html