Files
Smart-Farm/view/massage/tcp/game_list.html
2025-12-22 14:34:25 +08:00

122 lines
2.9 KiB
HTML

<!--
* @Description:
* @Author: xiao li
* @Date: 2021-10-28 09:47:20
* @LastEditTime: 2021-10-29 17:35:58
* @LastEditors: xiao li
-->
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>实时排行榜</title>
<style>
body{
width: 416px;
height: 160px;
padding: 0;
margin: 0;
}
.flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.box{
width: 414px;
height: 158px;
background: black;
color: red;
border: 1px solid red;
overflow: hidden;
text-align: center;
}
table{
width: 414px;
height: 45px;
font-size: 1rem;
font-weight:bold;
border-bottom: 1px solid red;
}
.info{
width: 414px;
height: 114px;
overflow: hidden;
}
table td,
.info-item{
width: 33.3%;
}
.info-item{
height: 37px;
line-height: 37px;
font-size: 0.9rem;
display:block;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
.info .flex-center{
padding: 0 5px;
border-bottom: 1px dashed red;
}
</style>
</head>
<body>
<div class="box">
<table>
<tr>
<td>车手</td>
<td>最快圈速</td>
<td>刷圈日期</td>
</tr>
</table>
<div id="mq" class="info" height="118">
<?php foreach ($data as $key => $value){ ?>
<div class="flex-center">
<div class="info-item"><?php printf($value["user_name"] )?></div>
<div class="info-item"><?php printf($value["best_time"] )?></div>
<div class="info-item"><?php printf($value["start_time"] )?></div>
</div>
<?php } ?>
</div>
</div>
<script>
let num = '{$count}'
console.log(num,"====num")
var oMarquee = document.getElementById("mq"); //滚动对象
var iLineHeight = 38; //单行高度,像素
var iLineCount = 9; //实际行数
var iScrollAmount = 2; //每次滚动高度,像素
function run() {
oMarquee.scrollTop += iScrollAmount;
if (oMarquee.scrollTop == iLineCount * iLineHeight) oMarquee.scrollTop = 0;
if (oMarquee.scrollTop % iLineHeight == 0) {
window.setTimeout("run()", 5000);
} else {
window.setTimeout("run()", 10);
}
}
if(num > 3){
oMarquee.innerHTML += oMarquee.innerHTML;
window.setTimeout("run()", 5000);
}
</script>
</body>
</html>