失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 用css3和jquery实现的渐变的动态进度条

用css3和jquery实现的渐变的动态进度条

时间:2022-01-04 06:05:10

相关推荐

用css3和jquery实现的渐变的动态进度条

web前端|css教程

css3 jquery

web前端-css教程

进度条是网站中常见的一种,今天经过研究外国一个网站的例子,试着用css3来实现进度条:

人人分销插件源码,vscode中git命令,163 源 ubuntu,静态部署tomcat,sqlite是哪个公司的,自定义生成手机页面前端框架,广东有什么爬虫养殖户,php curl 64位,seo配置文件,时时彩票网站源代码,电商商城html网页源码,html订单列表模板lzw

html代码如下:

化工网站源码,ubuntu光盘本地源,tomcat启动和停止访问,手工爬虫机器,php 站点发布,seo公司实力乐云seolzw

Set above to:

usb 检测 源码,vscode ,ubuntu安装im,tomcat吞吐,sqlite极速存储,阿里云服务器数据迁移,h5上传附件插件,前端mvvm框架目的,java 爬虫获取图片,try php,泽成SEO,课件网站源码,qt获取网页源码,wordpress 企业网站模板,前端管理页面模板,企业表单管理系统,PHP红包程序lzw

Set above to:

Set above to:

css样式:

body{ background:#222; width:360px; margin:0 auto; font:13px rebuchet MS,Arial,Helvetica;}h2, p {text-align: center;color: #fafafa;text-shadow: 0 1px 0 #111; } a {color: #777;} .progress-bar{ background-color:#1a1a1a; height:25px; padding:5px; width:350px; margin:70px 0 20px 0;-moz-border-radius:5px; -webkit-border-raidus:5px; border-radius:5px;-moz-box-shadow:0 1px 5px #000 inset, 0 1px 0 #444;-webkit-box-shadow:0 1px 5px #1a1a1a inset,0 1px 0 #444; box-shadow:0 1px 5px inset,0 1px 0 #444; }.progress-bar span{ display:inline-block; height:100%; background-color:#777; -moz-border-radius:3px;-webkit-border-radius:3px; border-radius:3px; border-radius:3px; box-shadow:0 1px 0 rgba(255,255,255,.5) inset; -webkit-box-shadow:0 1px 0 rgba(255,255,.5) inset; -moz-box-shadow:0 1px 0 rgba(255,255,.5) inset; -webkit-transition:width .4s ease-in-out; -moz-transition:width .4s ease-in-out;-ms-transition:width .4s ease-in-out;transition: width .4s ease-in-out; }

主要实现进度条的背景:

.blue span { background-color: #34c2e3; }.orange span{background-color:#fecf23;background-image:-webkit-gradient(linear,left top,left bottom,from(#fecf23), to(#fd9215));background-image:-webkit-linear-gradient(top,#fecf23, #fd9215);background-image:-moz-linear-gradient(top,#fecf23, #fd9215);background-image:-ms-linear-gradient(top, #fecf23, #fd9215);background-image:-o-linear-gradient(top, #fecf23, #fd9215);background-image: linear-gradient(top, #fecf23, #fd9215);filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#fecf23, endColorstr=#fd9215); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#fecf23, endColorstr=#fd9215)"; /* IE8 */} .green span{ background-color:#a5df41; background-image:-webkit-gradient(linear,left top,left bottom,from(#a5df41), to(#4ca916)); background-image:-webkit-linear-gradient(top,#a5df41, #4ca916); background-image:-moz-linear-gradient(top,#a5df41, #4ca916); background-image: -ms-linear-gradient(top, #a5df41, #4ca916); background-image: -o-linear-gradient(top, #a5df41, #4ca916); background-image: linear-gradient(top, #a5df41, #4ca916); filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#a5df41, endColorstr=#4ca916); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#a5df41, endColorstr=#4ca916)"; /* IE8 */ } .stripes span { -webkit-background-size: 30px 30px; -moz-background-size: 30px 30px; background-size: 30px 30px; background-image: -webkit-gradient(linear, left top, right bottom,color-stop(.25, rgba(255, 255, 255, .15)), color-stop(.25, transparent),color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .15)),color-stop(.75, rgba(255, 255, 255, .15)), color-stop(.75, transparent),to(transparent)); background-image: -webkit-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,transparent 75%, transparent); background-image: -moz-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,transparent 75%, transparent); background-image: -ms-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,transparent 75%, transparent); background-image: -o-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,transparent 75%, transparent); background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,transparent 75%, transparent);-webkit-animation: animate-stripes 3s linear infinite; -moz-animation: animate-stripes 3s linear infinite; } @-webkit-keyframes animate-stripes { 0% {background-position: 0 0;} 100% {background-position: 60px 0;} } @-moz-keyframes animate-stripes { 0% {background-position: 0 0;} 100% {background-position: 60px 0;} } .shine span { position: relative; }.shine span::after { content: \; opacity: 0; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #fff; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px;-webkit-animation: animate-shine 2s ease-out infinite; -moz-animation: animate-shine 2s ease-out infinite; } @-webkit-keyframes animate-shine { 0% {opacity: 0; width: 0;} 50% {opacity: .5;} 100% {opacity: 0; width: 95%;} } @-moz-keyframes animate-shine { 0% {opacity: 0; width: 0;} 50% {opacity: .5;} 100% {opacity: 0; width: 95%;} } /*---------------------------*/ .glow span { -moz-box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset; -webkit-box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset; box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset; -webkit-animation: animate-glow 1s ease-out infinite; -moz-animation: animate-glow 1s ease-out infinite; } @-webkit-keyframes animate-glow { 0% { -webkit-box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset;} 50% { -webkit-box-shadow: 0 5px 5px rgba(255, 255, 255, .3) inset, 0 -5px 5px rgba(255, 255, 255, .3) inset;} 100% { -webkit-box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset;} } @-moz-keyframes animate-glow { 0% { -moz-box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset;} 50% { -moz-box-shadow: 0 5px 5px rgba(255, 255, 255, .3) inset, 0 -5px 5px rgba(255, 255, 255, .3) inset;} 100% { -moz-box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset;} }

jquey部分:

$(document).ready(function(){ $(.quarter).click(function(){ $(this).parent().prev().children("span").css(width,25%); }); $(.half).click(function(){ $(this).parent().prev().children(span).css("width",50%); }); $(.three-quarters).click(function(){$(this).parent().prev().children(span).css(width,75%);});$(.full).click(function(){ $(this).parent().prev().children(span).css(width,100%); }) })

如果觉得《用css3和jquery实现的渐变的动态进度条》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。