jquery如何实现记分进度条效果?
Admin 2021-08-26 群英技术资讯 837 次浏览
这篇文章主要给大家分享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进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
本篇文章带大家了解一下Angular中的独立组件,看看怎么在Angular中创建一个独立组件,怎么在独立组件中导入已有的模块,希望对大家有所帮助!
这篇文章主要介绍了vue的provide和inject使用方法及其原理,本文通过源码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
这篇文章主要介绍了JavaScript中isPrototypeOf函数,isPrototypeOf() 是 Object函数(类)的下的一个方法,用于判断当前对象是否为另外一个对象的原型,如果是就返回 true,否则就返回 false,下面来看看详细内容,需要的朋友可以参考一下
这篇文章我们来简单了解JavaScript数据可视化库,对于 JS 开发人员来说,可视化数据的能力与制作交互式网页一样有价值。下文给大家介绍了很多受欢迎或有趣的JavaScript数据可视化库,感兴趣的朋友就继续往下看吧。
本篇文章带大家了解一下node.js中的module-alias,介绍一下module-alias原理、module-alias的一个常见问题(坑),希望对大家有所帮助!
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008