jquery如何实现记分进度条效果?
Admin 2021-08-26 群英技术资讯 1057 次浏览
这篇文章主要给大家分享jquery实现记分进度条效果的内容,感兴趣的朋友可以借鉴参考一下,希望大家阅读完这篇文章能有所收获,下面我们一起来学习一下吧。
1.先看效果

2.代码如下

jquery.lineProgressbar.js代码如下
(function($){
'use strict';
$.fn.LineProgressbar = function(options){
var options = $.extend({
percentage : null,
ShowProgressCount: true,
duration: 1000,
// Styling Options
fillBackgroundColor: '#3498db',
backgroundColor: '#EEEEEE',
radius: '0px',
height: '10px',
width: '100%'
},options);
return this.each(function(index, el) {
// Markup
$(el).html('<div class="progressbar"><div class="proggress"></div></div><div class="percentCount"></div>');
var progressFill = $(el).find('.proggress');
var progressBar= $(el).find('.progressbar');
progressFill.css({
backgroundColor : options.fillBackgroundColor,
height : options.height,
borderRadius: options.radius
});
progressBar.css({
width : options.width,
backgroundColor : options.backgroundColor,
borderRadius: options.radius
});
// Progressing
progressFill.animate(
{
width: options.percentage + "%"
},
{
step: function(x) {
if(options.ShowProgressCount){
$(el).find(".percentCount").text("("+Math.round(x) + "分"+")");
}
},
duration: options.duration
}
);
});
}
})(jQuery);
jquery.lineProgressbar.css样式代码如下
#progressbar1{
display: flex;
height: 15px;
}
.progressbar {
width: 50%;
margin-top: 5px;
position: relative;
background: #182746 !important;
border-radius: 6px !important;
box-shadow: inset 0px 1px 1px rgba(0,0,0,.1);
}
.proggress{
height: 8px;
width: 10px;
background: linear-gradient(to right, rgb(13, 93, 176), rgb(32, 177, 223)) !important;
border-radius: 6px !important;
}
.percentCount{
white-space: nowrap;
margin-left: 10px;
font-size: 14px;
}
这样就可以实现记分条,百分比的话只需要将分改成%就OK了。
直接用!!!
关于jquery实现记分进度条的效果就分享到这里了,上述代码仅供参考,希望本文对大家学习jquery有帮助,想要了解更多jquery实现进度条的内容,大家可以关注其他相关文章。
文本转载自脚本之家
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
这篇文章主要为大家介绍了Three.js创建文字初体验,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
本文主要介绍vue中循环取对象数组里的值的方法,对大家学习怎么取对象数组的值有一定的参考价值,需要的朋友可了解看看,下面我们就来了解看看具体的实现代码。
这篇文章主要介绍了vue 如何实现拖拽动态生成组件的需求,帮助大家更好的理解和学习使用vue框架,感兴趣的朋友可以了解下
我们都知道urlencode编码一般用于url网址中,它的格式是带有 % 符号的十六进制编码,起着保护隐私的作用,例如这段url编码“%ce%d2%ca%c7%d6%d0%b9%fa%c8%cb(我是中国人)”,是gbk版本的,那么我们该如何来使用js解析这一段gbk2313的编码呢?代码如下: //
作为原型和原型链的基础,先了解清楚构造函数以及它的执行过程才能更好地帮助我们学习原型和原型链的知识。本篇文章带大家详细了解一下JavaScript中的构造函数,介绍一下怎么利用构造函数创建一个js对象,希望对大家有所帮助!
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 ICP核准(ICP备案)粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008