jquery如何实现记分进度条效果?
Admin 2021-08-26 群英技术资讯 561 次浏览
这篇文章主要给大家分享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进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
这篇文章主要给大家分享的是JavaScript回调函数的相关内容,回调用于数组,计时器函数,promise,事件处理程序等中,是JavaScript学习中需要掌握的内容,对此本文分享给大家做个参考。另外,一些朋友对于同步和异步回调不是很理解,文中也有很详细的介绍,感兴趣的朋友就继续往下看吧。
这篇文章主要给大家介绍了关于vue.js watch经常失效的场景与解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
这篇文章主要介绍了总结分享10个JavaScript代码优化小tips,文章围绕主题展开详细的内容介绍,具有一定的参考价值,需要的小伙伴可以参考一下
本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于分支优化的相关内容,如果有许多个判断条件,使用大量的if分支会使整个代码的可读性和可维护都大大降低,下面一起来看一下,希望对大家有帮助。
这篇文章给大家分享的是用JS怎样求两个数最大值的方法。下文分享了三种方法,对新手学习JavaScript的使用有一定的帮助,文中的示例代码介绍得很详细,有需要的朋友可以参考,接下来就跟随小编一起了解看看吧。
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008