实现效果:进度条从两边递减到中间,最后为0。
实现思路:
1、两个progress拼接
2、修改第一个progress的属性,dir="rtl",将其反转,实现value为0时在右边。
3、定时或者递归调用,实现自动递减,递减速度可调节
4、调整progress高度
<!DOCTYPE html>
<html lang="zh-cmn-hans">
<head>
<meta charset="utf-8">
<title>progress</title>
<script type="text/javascript">
var n = 120
window.onload = function () {
start_run(n);
}
function start_run(n) {
var progress1 = document?.getElementById("pro1")
var progress2 = document?.getElementById("pro2")
n = n - 1
n = n <= 0 ? 120 : n
progress1.value = n
progress2.value = n
setTimeout("start_run(" + n + ")", 100)
}
</script>
</head>
<body>
<progress dir="rtl" value="120" max="120" id="pro1" style="height: 3px;"></progress><progress value="120" max="120"
id="pro2" style="height: 3px;"></progress>
</body>
</html>