這篇文章主要講解了“如何實現(xiàn)基于css3的列表toggle特效”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“如何實現(xiàn)基于css3的列表toggle特效”吧!

從網(wǎng)站建設(shè)到定制行業(yè)解決方案,為提供網(wǎng)站制作、網(wǎng)站建設(shè)服務(wù)體系,各種行業(yè)企業(yè)客戶提供網(wǎng)站建設(shè)解決方案,助力業(yè)務(wù)快速發(fā)展。創(chuàng)新互聯(lián)建站將不斷加快創(chuàng)新步伐,提供優(yōu)質(zhì)的建站服務(wù)。
實現(xiàn)的代碼。
htm代碼:
復(fù)制內(nèi)容到剪貼板
<div class='menu'>
toggle visibility</div>
<ul class='list reverse'>
<li class='item'>Item 1</li>
<li class='item'>Item 2</li>
<li class='item'>Item 3</li>
<li class='item'>Item 4</li>
<li class='item'>Item 5</li>
<li class='item'>Item 6</li>
<li class='item'>Item 7</li>
<li class='item'>Item 8</li>
<li class='item'>Item 9</li>
<li class='item'>Item 10</li>
<li class='item'>Item 11</li>
<li class='item'>Item 12</li>
</ul>
css3代碼:
CSS Code復(fù)制內(nèi)容到剪貼板
* {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: 'Avenir Next';
background: #000;
color: white;
}
.menu {
background: tomato;
padding: 20px;
position: absolute;
z-index: 1;
height: 55px;
top: 0;
rightright: 50px;
}
.list {
-webkit-perspective: 100vw;
perspective: 100vw;
width: 100vw;
height: 100vh;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-flow: column wrap;
-ms-flex-flow: column wrap;
flex-flow: column wrap;
}
.list.hidden {
pointer-events: none;
}
.list.hidden .item {
-webkit-animation: disappear both;
animation: disappear both;
-webkit-animation-direction: alternate;
animation-direction: alternate;
}
.list.reverse {
-webkit-flex-flow: row-reverse wrap-reverse;
-ms-flex-flow: row-reverse wrap-reverse;
flex-flow: row-reverse wrap-reverse;
}
.item {
font-size: 30px;
padding: 20px;
height: 100px;
width: calc(100vw / 3);
height: calc(100vh / 4);
-webkit-animation: appear both;
animation: appear both;
}
.item:nth-child(1) {
background: #008a8a;
-webkit-animation-delay: 0.03333s !important;
-webkit-animation-duration: 0.1s !important;
}
.item:nth-child(2) {
background: #009494;
-webkit-animation-delay: 0.06667s !important;
-webkit-animation-duration: 0.2s !important;
}
.item:nth-child(3) {
background: #009f9f;
-webkit-animation-delay: 0.1s !important;
-webkit-animation-duration: 0.3s !important;
}
.item:nth-child(4) {
background: #00a9a9;
-webkit-animation-delay: 0.13333s !important;
-webkit-animation-duration: 0.4s !important;
}
.item:nth-child(5) {
background: #00b3b3;
-webkit-animation-delay: 0.16667s !important;
-webkit-animation-duration: 0.5s !important;
}
.item:nth-child(6) {
background: #00bdbd;
-webkit-animation-delay: 0.2s !important;
-webkit-animation-duration: 0.6s !important;
}
.item:nth-child(7) {
background: #00c7c7;
-webkit-animation-delay: 0.23333s !important;
-webkit-animation-duration: 0.7s !important;
}
.item:nth-child(8) {
background: #00d2d2;
-webkit-animation-delay: 0.26667s !important;
-webkit-animation-duration: 0.8s !important;
}
.item:nth-child(9) {
background: #00dcdc;
-webkit-animation-delay: 0.3s !important;
-webkit-animation-duration: 0.9s !important;
}
.item:nth-child(10) {
background: #00e6e6;
-webkit-animation-delay: 0.33333s !important;
-webkit-animation-duration: 1s !important;
}
.item:nth-child(11) {
background: #00f0f0;
-webkit-animation-delay: 0.36667s !important;
-webkit-animation-duration: 1.1s !important;
}
.item:nth-child(12) {
background: #00fafa;
-webkit-animation-delay: 0.4s !important;
-webkit-animation-duration: 1.2s !important;
}
@-webkit-keyframes appear {
from {
opacity: 0;
-webkit-transform: scale(0.8);
transform: scale(0.8);
}
to {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes appear {
from {
opacity: 0;
-webkit-transform: scale(0.8);
transform: scale(0.8);
}
to {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
}
@-webkit-keyframes disappear {
from {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
to {
opacity: 0;
-webkit-transform: scale(0.9) rotateX(0deg) translateZ(-1500px);
transform: scale(0.9) rotateX(0deg) translateZ(-1500px);
}
}
@keyframes disappear {
from {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
to {
opacity: 0;
-webkit-transform: scale(0.9) rotateX(0deg) translateZ(-1500px);
transform: scale(0.9) rotateX(0deg) translateZ(-1500px);
}
}
感謝各位的閱讀,以上就是“如何實現(xiàn)基于css3的列表toggle特效”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對如何實現(xiàn)基于css3的列表toggle特效這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!
新聞名稱:如何實現(xiàn)基于css3的列表toggle特效
URL地址:http://chinadenli.net/article8/ppdiip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、營銷型網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、網(wǎng)站設(shè)計公司、標簽優(yōu)化、App設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)