功能介绍:jquery做一个横向百分比进度条,数据从接口读取,实时刷新数据,进度条需要记住上一次的地方进行前后滑动,不能每次都从0开始加载。
具体代码如下:
html代码:
<div class="horizontal-percen"> <span id="horizontal"></span> </div>
css代码:
body{
background: #77a5f1;
display: flex;
align-items: center;
height: 100vh;
justify-content: center;
}
.horizontal-percen {
position: relative;
margin: 79px auto;
width: 280px;
height: 20px;
border-radius: 20px;
background: white;
overflow: hidden;
}
.horizontal-percen span {
position: absolute;
width: 20%;
height: 20px;
border-radius: 20px;
background: linear-gradient(to right, #fc770a, #ffd739);
transition: all .5s;
}
jquery代码:
let stripMeet = roundMeet = 100,
stripValue = roundValue = 20,
stripInterval = null,
roundInterval = null;
//进度条效果
let UpDataSpeed = (val, isStrip, isClear) = >{
if (isStrip) {
if (isClear) {
window.clearInterval(stripInterval);
}
$('#horizontal').css('width', val + '%').find('b').text(val + '%');
} else {
if (isClear) {
window.clearInterval(roundInterval);
}
}
};
//自动改变进度条
window.clearInterval(stripInterval);
stripInterval = window.setInterval(function() {
stripValue = parseInt(Math.random() * stripMeet);
UpDataSpeed(parseInt((stripValue / stripMeet) * stripMeet), true);
},
2000);
上面是“jquery做一个横向百分比进度条(动态加载)”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3267.html
workflows工作流
一架令人难忘的美丽钢琴ComfyUI工作流
一位漂亮的女人坐在樱花树旁
一个迷人而丰满的女巫和一只黑猫骑着飞天扫帚
嘴唇丰满的漂亮女人
一只躲在一堆秋叶里的小刺猬
一位穿着长袍的强大法师ComfyUI工作流
一个港口配备了小型船只、起重机、集装箱和码头
一颗翡翠玉雕盆栽树comfyui工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

利用js做一个炫酷音乐背景效果
一个包含老黄历、佛历、道历、星宿等数据的日历网站
3d文字动画效果
制作一个好玩的倒计时
javascript如何利用draggable实现一个拖拽效果
做一个好玩的时钟翻牌效果
用canvas实现画板涂鸦效果
css3实现星球旋转







