今天要给大家带来一款基于jquery带百分比的响应式进度加载条。这款加载条非常漂亮,而且带有进度的百度比,且在不同的百分比用的是不同的颜色。而且这款加载条采用了响应式设计,在不同的分辨率的显示器下完美支持。一起看下效果图吧。

在线预览   源码下载

实现的代码。

html代码:

<h1>Battle.net <b>style progress bar</b></h1><div class="progress"><b class="progress__bar"><span class="progress__text">Progress: <em>0%</em> </span></b></div>

css代码:

.progress {font-size: 1.2em;height: 20px;background: rgba(255, 255, 255, 0.05);border-radius: 2px;border: 1px solid rgba(255, 255, 255, 0.2);
}
.progress--active .progress__bar {opacity: 1;
}
.progress__text {width: 20em;padding: 0 0.9em;position: absolute;
}
.progress__text em {font-style: normal;
}
.progress__bar {color: white;font-size: 12px;font-weight: normal;text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);line-height: 19px;display: block;position: relative;top: -1px;left: -1px;width: 0%;height: 100%;opacity: 0;border: 1px solid;border-radius: 2px 0 0 2px;background-size: 100px 30px, 130px 30px, 130px 30px;background-position: -20% center, right center, left center;background-repeat: no-repeat, no-repeat, no-repeat;-webkit-transition: opacity 0.2s ease, width 0.8s ease-out, background-color 1s ease, border-color 0.3s ease, box-shadow 1s ease;transition: opacity 0.2s ease, width 0.8s ease-out, background-color 1s ease, border-color 0.3s ease, box-shadow 1s ease;-webkit-animation: pulse 2s ease-out infinite;animation: pulse 2s ease-out infinite;background-color: rgba(201, 4, 20, 0.95);background-image: -webkit-linear-gradient(0deg, rgba(226, 4, 22, 0) 10%, rgba(250, 6, 26, 0.8) 30%, #fb1f31 70%, rgba(250, 6, 26, 0.8) 80%, rgba(226, 4, 22, 0) 90%), -webkit-linear-gradient(left, rgba(251, 31, 49, 0) 0%, #fb1f31 100%), -webkit-linear-gradient(right, rgba(251, 31, 49, 0) 0%, #fb1f31 100%);background-image: linear-gradient(90deg, rgba(226, 4, 22, 0) 10%, rgba(250, 6, 26, 0.8) 30%, #fb1f31 70%, rgba(250, 6, 26, 0.8) 80%, rgba(226, 4, 22, 0) 90%), linear-gradient(to right, rgba(251, 31, 49, 0) 0%, #fb1f31 100%), linear-gradient(to left, rgba(251, 31, 49, 0) 0%, #fb1f31 100%);border-color: #fb3848;box-shadow: 0 0 0.6em #fa061a inset, 0 0 0.4em #e20416 inset, 0 0 0.5em rgba(201, 4, 20, 0.5), 0 0 0.1em rgba(254, 206, 210, 0.5);
}
.progress__bar--orange {background-color: rgba(201, 47, 0, 0.95);background-image: -webkit-linear-gradient(0deg, rgba(227, 53, 0, 0) 10%, rgba(252, 59, 0, 0.8) 30%, #ff4d17 70%, rgba(252, 59, 0, 0.8) 80%, rgba(227, 53, 0, 0) 90%), -webkit-linear-gradient(left, rgba(255, 77, 23, 0) 0%, #ff4d17 100%), -webkit-linear-gradient(right, rgba(255, 77, 23, 0) 0%, #ff4d17 100%);background-image: linear-gradient(90deg, rgba(227, 53, 0, 0) 10%, rgba(252, 59, 0, 0.8) 30%, #ff4d17 70%, rgba(252, 59, 0, 0.8) 80%, rgba(227, 53, 0, 0) 90%), linear-gradient(to right, rgba(255, 77, 23, 0) 0%, #ff4d17 100%), linear-gradient(to left, rgba(255, 77, 23, 0) 0%, #ff4d17 100%);border-color: #ff6030;box-shadow: 0 0 0.6em #fc3b00 inset, 0 0 0.4em #e33500 inset, 0 0 0.5em rgba(201, 47, 0, 0.5), 0 0 0.1em rgba(255, 214, 201, 0.5);
}
.progress__bar--yellow {background-color: rgba(232, 158, 0, 0.95);background-image: -webkit-linear-gradient(0deg, rgba(255, 174, 2, 0) 10%, rgba(255, 183, 28, 0.8) 30%, #ffbf36 70%, rgba(255, 183, 28, 0.8) 80%, rgba(255, 174, 2, 0) 90%), -webkit-linear-gradient(left, rgba(255, 191, 54, 0) 0%, #ffbf36 100%), -webkit-linear-gradient(right, rgba(255, 191, 54, 0) 0%, #ffbf36 100%);background-image: linear-gradient(90deg, rgba(255, 174, 2, 0) 10%, rgba(255, 183, 28, 0.8) 30%, #ffbf36 70%, rgba(255, 183, 28, 0.8) 80%, rgba(255, 174, 2, 0) 90%), linear-gradient(to right, rgba(255, 191, 54, 0) 0%, #ffbf36 100%), linear-gradient(to left, rgba(255, 191, 54, 0) 0%, #ffbf36 100%);border-color: #ffc74f;box-shadow: 0 0 0.6em #ffb71c inset, 0 0 0.4em #ffae02 inset, 0 0 0.5em rgba(232, 158, 0, 0.5), 0 0 0.1em rgba(255, 248, 232, 0.5);
}
.progress__bar--green {background-color: rgba(0, 178, 23, 0.95);background-image: -webkit-linear-gradient(0deg, rgba(0, 203, 26, 0) 10%, rgba(0, 229, 30, 0.8) 30%, #00fe21 70%, rgba(0, 229, 30, 0.8) 80%, rgba(0, 203, 26, 0) 90%), -webkit-linear-gradient(left, rgba(0, 254, 33, 0) 0%, #00fe21 100%), -webkit-linear-gradient(right, rgba(0, 254, 33, 0) 0%, #00fe21 100%);background-image: linear-gradient(90deg, rgba(0, 203, 26, 0) 10%, rgba(0, 229, 30, 0.8) 30%, #00fe21 70%, rgba(0, 229, 30, 0.8) 80%, rgba(0, 203, 26, 0) 90%), linear-gradient(to right, rgba(0, 254, 33, 0) 0%, #00fe21 100%), linear-gradient(to left, rgba(0, 254, 33, 0) 0%, #00fe21 100%);border-color: #19ff37;box-shadow: 0 0 0.6em #00e51e inset, 0 0 0.4em #00cb1a inset, 0 0 0.5em rgba(0, 178, 23, 0.5), 0 0 0.1em rgba(178, 255, 188, 0.5);
}
.progress__bar--blue {background-color: rgba(18, 135, 204, 0.95);background-image: -webkit-linear-gradient(0deg, rgba(20, 151, 227, 0) 10%, rgba(37, 162, 236, 0.8) 30%, #3dacee 70%, rgba(37, 162, 236, 0.8) 80%, rgba(20, 151, 227, 0) 90%), -webkit-linear-gradient(left, rgba(61, 172, 238, 0) 0%, #3dacee 100%), -webkit-linear-gradient(right, rgba(61, 172, 238, 0) 0%, #3dacee 100%);background-image: linear-gradient(90deg, rgba(20, 151, 227, 0) 10%, rgba(37, 162, 236, 0.8) 30%, #3dacee 70%, rgba(37, 162, 236, 0.8) 80%, rgba(20, 151, 227, 0) 90%), linear-gradient(to right, rgba(61, 172, 238, 0) 0%, #3dacee 100%), linear-gradient(to left, rgba(61, 172, 238, 0) 0%, #3dacee 100%);border-color: #54b6f0;box-shadow: 0 0 0.6em #25a2ec inset, 0 0 0.4em #1497e3 inset, 0 0 0.5em rgba(18, 135, 204, 0.5), 0 0 0.1em rgba(225, 242, 252, 0.5);
}
.progress__bar:before, .progress__bar:after {content: "";position: absolute;right: -1px;top: -10px;width: 1px;height: 40px;
}
.progress__bar:before {width: 7px;right: -4px;background: -webkit-radial-gradient(center, ellipse, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 75%);background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 75%);
}
.progress__bar:after {background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.3) 25%, rgba(255, 255, 255, 0.3) 75%, rgba(255, 255, 255, 0) 100%);background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.3) 25%, rgba(255, 255, 255, 0.3) 75%, rgba(255, 255, 255, 0) 100%);
}
.progress--complete .progress__bar {-webkit-animation: none;animation: none;border-radius: 2px;
}
.progress--complete .progress__bar:after, .progress--complete .progress__bar:before {opacity: 0;
}@-webkit-keyframes pulse {0% {background-position: -50% center, right center, left center;}100% {background-position: 150% center, right center, left center;}
}@keyframes pulse {0% {background-position: -50% center, right center, left center;}100% {background-position: 150% center, right center, left center;}
}
body, html {color: white;padding: 20px 50px;background: #131c23;font-family: Roboto;
}h1 {font-weight: 900;line-height: 1em;margin: 0.5em 0;
}h1 b {font-weight: 100;
}

js代码:

  var $progress = $(".progress"),$bar = $(".progress__bar"),$text = $(".progress__text"),percent = 0,update,resetColors,speed = 200,orange = 30,yellow = 55,green = 85,timer;resetColors = function () {$bar.removeClass("progress__bar--green").removeClass("progress__bar--yellow").removeClass("progress__bar--orange").removeClass("progress__bar--blue");$progress.removeClass("progress--complete");};update = function () {timer = setTimeout(function () {percent += Math.random() * 1.8;percent = parseFloat(percent.toFixed(1));$text.find("em").text(percent + "%");if (percent >= 100) {percent = 100;$progress.addClass("progress--complete");$bar.addClass("progress__bar--blue");$text.find("em").text("Complete");} else {if (percent >= green) {$bar.addClass("progress__bar--green");}else if (percent >= yellow) {$bar.addClass("progress__bar--yellow");}else if (percent >= orange) {$bar.addClass("progress__bar--orange");}speed = Math.floor(Math.random() * 900);update();}$bar.css({ width: percent + "%" });}, speed);};setTimeout(function () {$progress.addClass("progress--active");update();}, 1000);$(document).on("click", function (e) {percent = 0;clearTimeout(timer);resetColors();update();}); //@ sourceURL=pen.js

注:本文爱编程原创文章,转载请注明原文地址:http://***/Article/7781

转载于:https://www.cnblogs.com/liaohuolin/p/4003728.html

一款基于jquery带百分比的响应式进度加载条相关推荐

  1. 一款基于jquery和css3的响应式二级导航菜单

    今天给大家分享一款基于jquery和css3的响应式二级导航菜单,这款导航是传统的基于顶部,鼠标经过的时候显示二级导航,还采用了当前流行的响应式设计.效果图如下: 在线预览   源码下载 实现的代码. ...

  2. 一款基于jQuery外观优雅带遮罩弹出层对话框

    今天我们要来分享一款基于jQuery的弹出层对话框插件,该插件包含多种对话框类型,比如提示框.确认框等.更为实用的是,这款jQuery对话框中的按钮事件也可以被我们所捕获,从而相应对话框按钮的各种事件 ...

  3. html css 圆形按钮 仿uc,10款基于jquery的web前端动画特效

    1.jQuery横向手风琴图片切换动画 之前我们为大家分享过很多款基于jQuery和CSS3的手风琴菜单和手风琴焦点图插件,比如CSS3响应式垂直手风琴菜单和jQuery横向手风琴图片展示插件.今天要 ...

  4. 10款基于jquery实现的超酷动画源码

    1.jQuery二级下拉菜单 下拉箭头翻转动画 之前我们分享过不少基于jQuery的二级下拉菜单,甚至是多级的下拉菜单,比如这款jQuery/CSS3飘带状多级下拉菜单就非常华丽.但今天要介绍的这款j ...

  5. html5卷轴展开动画,8款基于Jquery的WEB前端动画特效

    超级绚丽,20款前端动画特效,轰炸你的眼睛,一定要看到最后! 1.超炫酷的30个jQuery按钮悬停动画 按钮插件是最常见的jQuery插件之一,因为它用途广泛,而且配置起来最为方便.今天我们要分享的 ...

  6. 13款基于jQuery Mobile的布局插件和示例

    现在已经进入了移动互联网时代,因此将你的网站迁移到移动设备上就显得比较重要的.问题是,如何在移动设备的小屏幕中呈现你的网站中的所有内容呢? 本文介绍13款基于jQuery Mobile的布局插件和示例 ...

  7. 一款基于jquery和css3的头像恶搞特效

    今天给大家分享一款基于jquery和css3的头像恶搞特效.这款实例中,一个头像在画面中跳舞,头像还有可爱的帽子,单击下面的按钮可以为头像切换不同的帽子.效果图如下: 在线预览   源码下载 实现的代 ...

  8. 一款基于jquery ui的动画提交表单

    今天要给大家分享一款基于jquery ui的动画提交表单.这款提交表单的的效果是以动画的形式依次列表所需填写的信息.效果非常不错,效果图如下: 在线预览   源码下载 实现的代码. html代码: & ...

  9. 【精心挑选】10款基于 jQuery 的图片360度旋转插件

    之前的文章向大家分享了实现网站功能的各种优秀的 jQuery 插件,今天这篇文章向大家推荐10款基于 jQuery 的图片360度旋转插件,同时还有非常详细的制作教程可以学习和参考.图片旋转展示是一种 ...

最新文章

  1. 程序设计语言python语言概述
  2. 《现代前端技术解析》读后鬼扯
  3. Two Paths CodeForces - 14D(暴力+树的直径)
  4. 从数学的角度来谈谈,孩子为什么要学编程!
  5. [Leedcode][JAVA][第15题][三数之和][数组][双指针]
  6. php postgresql多条,PHPPostgreSQL函数列表 - phpStudy
  7. xgboost算法_XGBoost算法可能会长期占据你的视野!
  8. 数据平台之企业营销管理与分析平台建设
  9. 会看源码,你将比98.3%的人更容易拿到百度、阿里、腾讯、字节跳动等大公司的高薪Offer!请看这几个公众号!...
  10. 联想电脑linux显卡驱动,如何安装从联想官网下载的显卡驱动
  11. 成都盛铭轩:商家怎么装修设计
  12. 自己搭建虚拟服务器,如何自己搭建虚拟主机
  13. 获取某网站在alexa上的排名
  14. 关于举办“2020·中国边缘计算企业20强”榜单评选通知
  15. java 二进制报文头_使用Netty收发二进制报文问题记
  16. CUDA中的数学函数
  17. 计算机桌面图标乱码,电脑软件上的文字变乱码怎么办?怎么修复?
  18. 产品经理入门03:需求评审和技术评审
  19. 阿里云和华为云各自的优势
  20. [Leetcode学习-java]Additive Number

热门文章

  1. background-attachment:fixed应用
  2. topcpder SRM 664 div2 A,B,C BearCheats , BearPlays equalPiles , BearSorts (映射)
  3. jQuery(function(){...})与(function($){...})(jQuery)的“兄弟”情结
  4. 练习系列 - 5、求子数组的最大和
  5. (转)Cairngorm初学者入门教程 第三节--从使用Model Locator开始学起Cairngorm
  6. android wheelview 字体颜色,百行代码实现Android WheelView
  7. 创业冲突的五种解决方法是_当创业合伙人发生冲突时,最好的解决办法看这5招...
  8. 图解ARP协议(四)代理ARP原理与实践(“善意的欺骗”)
  9. 政企应用如何构筑安全合规的互联内容分发加速?
  10. 字节跳动 Flink 单点恢复功能实践