jquery如何实现记分进度条效果?
Admin 2021-08-26 群英技术资讯 617 次浏览
这篇文章主要给大家分享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进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
在前端开发的时候,我们往往会使用到tab栏切换,例如一些双项选择就可以使用tab栏切换效果来实现。下面我们就看看二选一的tab栏切换是怎么做的?
Webpack是一款模块打包工具。它为不同的依赖创建模块,将其整体打包成可管理的输出文件。这一点对于单页面应用(如今Web应用的事实标准)来说特别有用。
这篇文章主要为大家详细介绍了小程序自定义tabBar组件封装,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
这篇文章小编给大家分享的是Nodejs中fs文件系统怎样使用的内容,下文对fs文件系统怎样使用介绍的很详细,感兴趣的朋友可以了解看看,下面让我们一起来学习一下吧!
通过改变默认npm镜像代理服务,以下三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候不用重新配置。通过config命令npmconfigsetregistry https://registry.npm.taobao.orgnpminfounderscore(如果上面配置正确这个命令会有字符串response)命令行指定npm--registry
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008