- 前言
工作中用到了这么个东西,时间紧急搜索了一种写法临时用。空闲下来准备自己写一个,简单花了一点时间写了个demo,分享一下。(注意:这个demo只经过了简单测试,你要是在实际项目中用是需要自己调整的)
- 代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0;
}
#app {
height: 100vh;
background-color: #ccc;
padding: 1px;
box-sizing: border-box;
}
#app div {
overflow-x: hidden;
white-space: nowrap;
}
#app div p {
width: fit-content;
transition: transform 16.7ms;
margin: 0;
display: flex;
}
#app d