通過css動畫實(shí)現(xiàn)一個表格滾動輪播效果
發(fā)布時(shí)間:2020-03-11 11:57:58 作者:辛巴德2018
我要評論
這篇文章主要介紹了通過css動畫實(shí)現(xiàn)一個表格滾動輪播效果,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下
css動畫的一個應(yīng)用,與此前的css走馬燈同樣的內(nèi)容。只是一次不同的應(yīng)用,具體實(shí)現(xiàn)如下

<template>
<section>
<div class="box">
<ul class="header">
<li class="cell">序號</li>
<li class="cell">姓名</li>
<li class="cell">年齡</li>
<li class="cell">性別</li>
<li class="cell">專業(yè)</li>
</ul>
<div class="body">
<ul class="list">
<li
v-for="(item, index) in arr"
:key="index"
class="row"
>
<span class="cell">{{ item }}</span>
<span v-for="(n) in 4" :key="n*30" class="cell">{{ n }}</span>
</li>
</ul>
</div>
</div>
</section>
</template>
<script>
export default {
data() {
return {
arr: [],
}
},
created() {
this.arr = Array.from(new Array(20), (v, k) => {
return k + 1
})
// 表格顯示5行數(shù)據(jù),此處復(fù)制開頭的5條數(shù)據(jù)實(shí)現(xiàn)無縫
this.arr = this.arr.concat(this.arr.slice(0, 5))
}
}
</script>
<style lang="scss">
$cellHeight: 30px;
ul {
list-style: none;
margin: 0;
padding: 0;
}
.box {
width: 60%;
margin: auto;
}
.header {
display: flex;
}
.body {
height: 5 * $cellHeight;
overflow: hidden;
// padding-bottom: 10px;
li {
display: flex;
height: $cellHeight;
}
}
.cell {
flex: 1;
height: $cellHeight;
line-height: $cellHeight;
border: 1px solid #e2e2e2;
box-sizing: border-box;
}
.list {
animation: scroll 10s linear infinite;
position: relative;
}
@keyframes scroll {
from { top: 0; }
to { top: -20 * $cellHeight }
}
</style>
總結(jié)
到此這篇關(guān)于通過css動畫實(shí)現(xiàn)一個表格滾動輪播效果的文章就介紹到這了,更多相關(guān)css 動畫表格滾動輪播內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
- 輪播圖,網(wǎng)頁上經(jīng)常能看得見,畫面比較精美,下面是純CSS3的輪播圖的一種,感興趣的朋友一起看看吧2019-11-11

css實(shí)現(xiàn)帶箭頭和圓點(diǎn)的輪播
這篇文章主要介紹了css實(shí)現(xiàn)帶箭頭和圓點(diǎn)的輪播的相關(guān)資料,當(dāng)鼠標(biāo)移入圖片、圓點(diǎn)和方向鍵時(shí),停止輪播,移除恢復(fù)。具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-08-28
這篇文章主要介紹了純HTML和CSS實(shí)現(xiàn)JD輪播圖效果,需要的朋友可以參考下2018-06-01
利用 CSS3 實(shí)現(xiàn)的無縫輪播功能代碼
本文通過實(shí)例代碼給大家介紹了基于css3實(shí)現(xiàn)的無縫輪播效果,代碼簡單易懂,非常不錯,具有參考借鑒價(jià)值,需要的朋友參考下吧2017-09-25
HTML+CSS+JS實(shí)現(xiàn)堆疊輪播效果的示例代碼
這篇文章主要介紹了HTML+CSS+JS實(shí)現(xiàn)堆疊輪播效果,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-09-08





