当前位置:网站首页>JS to realize automatic scrolling of announcements
JS to realize automatic scrolling of announcements
2022-04-21 21:43:00 【Colorful cat worm】

html
<div class="test003">
<div class="test004">
<div class="testTop"><span class="span1"> full name </span>
<span class="span2"> state </span>
<span class="span3"> Query score </span>
</div>
<div id="box">
<ul id="list">
<li><span class="span1">173****3856</span>
<span class="span2"> stay 11:36 Inquire about </span>
<span class="span3">108 branch </span>
<li>
<li><span class="span1">139****1926</span>
<span class="span2"> stay 11:49 Inquire about </span>
<span class="span3">120 branch </span>
<li>
<li><span class="span1">137****2575</span>
<span class="span2"> stay 09:59 Inquire about </span>
<span class="span3">110 branch </span>
<li>
<li><span class="span1">181****6973</span>
<span class="span2"> stay 11:08 Inquire about </span>
<span class="span3">120 branch </span>
<li>
<li><span class="span1">133****1728</span>
<span class="span2"> stay 13:10 Inquire about </span>
<span class="span3">119 branch </span>
<li>
<li><span class="span1">186****2048</span>
<span class="span2"> stay 12:37 Inquire about </span>
<span class="span3">114 branch </span>
<li>
<li><span class="span1">153****0658</span>
<span class="span2"> stay 10:22 Inquire about </span>
<span class="span3">120 branch </span>
<li>
<li><span class="span1">150****3880</span>
<span class="span2"> stay 12:24 Inquire about </span>
<span class="span3">120 branch </span>
<li>
<li><span class="span1">189****5792</span>
<span class="span2"> stay 11:00 Inquire about </span>
<span class="span3">105 branch </span>
<li>
<li><span class="span1">157****3676</span>
<span class="span2"> stay 14:55 Inquire about </span>
<span class="span3">192 branch </span>
<li>
<li><span class="span1">150****3811</span>
<span class="span2"> stay 14:25 Inquire about </span>
<span class="span3">108 branch </span>
<li>
<li><span class="span1">173****4713</span>
<span class="span2"> stay 15:21 Inquire about </span>
<span class="span3">109 branch </span>
<li>
<li><span class="span1">159****7114</span>
<span class="span2"> stay 14:40 Inquire about </span>
<span class="span3">106 branch </span>
<li>
<li><span class="span1">180****2836</span>
<span class="span2"> stay 15:35 Inquire about </span>
<span class="span3">147 branch </span>
<li>
<li><span class="span1">187****3546</span>
<span class="span2"> stay 14:17 Inquire about </span>
<span class="span3">120 branch </span>
<li>
</ul>
</div>
</div>
</div>
css
<style type="text/css">
.test001 {
width: 100%;
border-top: 1px solid black;
border-bottom: 1px solid black;
text-align: center;
font-weight: bold;
font-size: 17px;
height: 70px;
display: flex;
justify-content: center;
align-items: center;
}
.test002 {
margin-top: 15px;
width: 100%;
text-align: center;
font-weight: bold;
font-size: 21px;
display: flex;
justify-content: center;
align-items: center;
}
.test003 {
margin-top: 15px;
width: 100%;
/* text-align: center; */
/* font-weight: bold; */
/* font-size: 21px; */
display: flex;
justify-content: center;
/* border: solid 1px; */
flex-direction: column;
align-items: center;
}
.test004 {
/* margin-top: 15px; */
width: 90%;
/* text-align: center; */
/* font-weight: bold; */
/* font-size: 21px; */
display: flex;
justify-content: center;
border: solid 1px;
flex-direction: column;
align-items: center;
}
.testTop {
width: 90%;
font-size: 14px;
height: 30px;
display: block;
font-weight: bold;
padding-left: 20px;
padding-top: 15px;
}
.testTop span {
margin-right: 75px;
}
.testTop .span2 {
margin-right: 65px;
}
#box {
width: 90%;
height: 250px;
line-height: 2em;
/* background-color: skyblue; */
margin-top: 15px;
/* margin: 100px auto; */
padding: 0 0px;
overflow: hidden;
}
#list li {
margin-top: 10px;
list-style: none;
}
#list span {
margin-right: 30px;
font-size: 14px;
display: inline-block;
overflow: hidden;
text-align: center;
}
#list .span1 {
width: 80px;
}
#list .span2 {
margin-right: 40px;
width: 80px;
}
#list .span3 {
width: 50px;
/* margin-right: 50px; */
/* text-align: left; */
/* border: 1px solid black; */
}
/* #list a:hover { color: orangered; text-decoration: underline; } */
</style>
js
<script>
var box = document.getElementById('box')
var list = document.getElementById('list')
console.log(box, 'box')
// Copy the document again
var content = list.innerHTML;
list.innerHTML += content;
var time = 30;
var timer = setInterval(up, time);
function up() {
// Roll up more than ul Half the height of the content , Reset height 0
if (box.scrollTop > (list.offsetHeight >> 1)) {
box.scrollTop = 0
} else {
box.scrollTop++;
}
}
// Mouse in pause -- Clear timer
// box.onmouseover = function () {
// clearInterval(timer)
// }
/// Move the mouse out and continue -- Start timer
box.onmouseout = function() {
timer = setInterval(up, time);
}
</script>
版权声明
本文为[Colorful cat worm]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204212140599179.html
边栏推荐
- Authing 正式加入 W3C 组织,将参与相关国际标准制定
- [selenium self study series] (I) selenium's first example and interaction principle
- [test case level definition]
- Workflow process setting customization development
- Summary of force deduction method 824 - goat Latin
- Shell programming learning (IV) read reading, function, file archiving and scheduled tasks
- TCP/IP协议
- 虚拟机关闭之后,重启linux之后,重启里面oracle的监听
- Hard core strength, recognized by many parties | cloud expansion technology, as the core manufacturer of RPA, was selected into the 2022 China RPA procurement guide
- Redis+Caffeine两级缓存,让访问速度纵享丝滑
猜你喜欢

Anxun cup 2021_ Crypto_ Reappearance

Reflex WMS study experience shelf principle

Communication between parent and child processes (I) -- working principle of pipeline + pipeline creation function pipe

一加连发两款耳机产品:充电10分钟 听歌20小时

【Selenium 自学系列】(一)Selenium第一个例子及交互原理

Communication between parent and child processes (II) -- four cases of anonymous pipeline communication

Operation instructions of training management system

Unity3d C uses the offset of material map to realize the function of unlimited moving background effect of 2D game single background image (including source code)

01_ Cross compile Hello program

Workflow engine parameter setting and business engine
随机推荐
Various DNS: Baidu DNS / Alibaba DNS / 114dns / Tencent DNS / Google DNS / OpenDNS comparison evaluation
Workflow report setting customization development
Eeasybi report system data source selection code development manual
docker MySQL定时备份
Jz19 regular expression matching
Live555 learning
3D printer cr-10s cr10s Pro ender-3 Ender 3pro Ender 5 how to modify the pulse value or transmission value E of the extrusion motor when replacing the BMG extruder
Bailian4006 little rabbit picks up gold coins [simulation]
FFmpeg连载3-视频解码
avformat_ new_ Stream understanding
危机四伏,卡士酸奶的高端人设还立得住吗?
Redis高级:数据删除与淘汰策略、主从复制、哨兵模式、集群cluster、企业级解决方案
After the virtual machine is shut down, restart Linux and restart Oracle monitoring inside
IDEA通过Jedis操作Linux上的Redis;Failed to connect to any host resolved for DNS name问题
分析师认为三星Galaxy Z Fold 4和Z Flip 4可能比其前代产品更便宜
2022R1快开门式压力容器操作操作证考试题库模拟考试平台操作
Dynamically connecting data sources and transaction rollback
Docker MySQL scheduled backup
2022r1 quick opening pressure vessel operation certificate examination question bank simulation examination platform operation
2022 high altitude installation, maintenance and demolition of examination question bank and simulated examination