~~~html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
list-style: none;
}
#ul {
position: relative;
top: 0px;
left: 0px;
}
li {
width: 200px;
height: 100px;
margin: 10px;
background-color: #f00;
color: #fff;
text-align: center;
font-size: 60px;
transition: all 0.3s ease-out;
}
</style>
</head>
<body>
<div style="height: 300px;overflow: hidden;">
<ul id="ul">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
</ul>
</div>
<button id="start">走起來</button>
<button id="reset">復位</button>
<script>
const ul = document.getElementById('ul')
const start = document.getElementById('start')
const reset = document.getElementById('reset')
let timerId
start.onclick = () => {
if(timerId) return
timerId = setInterval(() => {
const firstLi = document.querySelector('#ul li:first-child')
ul.style.transition = 'all 0.5s ease-out'
firstLi.style.opacity = 0
ul.style.top = -110 + 'px'
setTimeout(() => {
firstLi.removeAttribute('style')
// 模擬隨機添加數據
// const count = Math.random() * 10
// for(let i = count; i >0; i--) {
// ul.appendChild(firstLi.cloneNode(true))
// }
ul.appendChild(firstLi)
ul.style.transition = ''
ul.style.top = 0
}, 500)
}, 2000)
}
reset.onclick = () => {
clearInterval(timerId)
timerId = undefined
location.reload()
}
</script>
</body>
</html>
~~~
- 前端指南
- 基礎
- HTML、HTTP、web綜合問題
- css部分
- 學習指南
- 開發指南
- css指南
- JavaScript
- 視圖、文件
- canvas
- 二維碼的生成
- 64碼及圖片
- weui
- Promise
- 第三方js
- 網絡請求
- 字符串,數組,時間
- 時間類
- Css
- 布局封裝
- 媒體布局
- 九宮格圖片自適應
- 兩行顯示,且省略
- uni-app
- uniapp踩坑指南
- 表單類
- 商品規格
- 頁面操作
- H5端返回按鈕不顯示
- H5解決瀏覽器跨域問題
- uView——Waterfall 瀑布流
- uniapp中使用復制功能(復制文本到粘貼板)
- 動態導航欄的實現
- React
- React基礎
- 微信小程序
- 上傳多圖
- uni-app 微信小程序生成小程序碼二維碼帶參數
- 小程序分享圖片給好友,到朋友圈,保存到本地
- 緩存封裝
- Vue
- 深度作用選擇器deep
- 使用js實現列表無限循環滾動(橫向)
- js 無限循環垂直滾動列表
- 可視化
- AntV
- 玫瑰圖