动态进度条

170548_pJbf_2848195.png 170613_MAb2_2848195.png

<style>
 .progressBar{width:200px;height:8px;border:1px solid #98AFB7;border-radius:5px;margin-top:10px;}
 #bar{width:0px;height:8px;border-radius:5px;background:#5EC4EA;}
</style>
<script type="text/jscript" src="js/jquery1.11.3.min.js"></script>
<script type="text/javascript">
 function progressBar(){
  //初始化js进度条
  $("#bar").css("width","0px");
  //进度条的速度,越小越快
  var speed = 20;
  bar = setInterval(function(){
   nowWidth = parseInt($("#bar").width());
   //宽度要不能大于进度条的总宽度
   if(nowWidth<=200){
    barWidth = (nowWidth + 1)+"px";
    $("#bar").css("width",barWidth);
   }else{
    //进度条读满后,停止
    clearInterval(bar);
   } 
  },speed);
 }
</script>

html:

<input type="button" value="开始" onclick="progressBar()" />
 <div class="progressBar"><div id="bar"></div></div>

 

 

 

 

另外还有多项进度的:

171007_qUEe_2848195.png

171140_TeGn_2848195.png

171205_YwdE_2848195.png

<div class="fpwd-box">
				<!--<h5><b>忘记密码</b></h5>-->
				<div class="fpwd-top">
					<span style="width:0;" class="fp-jindu"></span>
					<div class="fp-step">
						<div class="fp-dcricle active-dash"><span class="active-fp">1</span></div>
						<p>验证身份</p>
					</div>
					<!------------fp-step2修改为fp-step-title2----->
					<div class="fp-step fp-step-title2">
						<div class="fp-dcricle"><span>2</span></div>
						<p>设置新密码</p>
					</div>
					<!------------fp-step3修改为fp-step-title3----->
					<div class="fp-step fp-step-title3">
						<div class="fp-dcricle"><span>3</span></div>
						<p>完成</p>
					</div>
				</div>
				<!----------忘记密码修改地方----------->
				<div class="fp-step1">
				    <p class="fp-p"><span class="fp-s">手机号 :</span><input type="text" class="fp-username" placeholder="在此输入手机号"></p>
				    <p class="fp-p"><span class="fp-s">验证码:</span><input type="text" class="fp-yanzhengma"><input type="button" class="send-ver2 auth-a" value="获取验证码" onclick="settime(this)"></p>
			        <a class="fp-next" href="javascrpt:;">下一步</a>
				</div>
			    <div class="fp-step2" style="display: none;">
			    	<p class="fp-p"><span class="fp-s">新登录密码:</span><input type="text" class="fp-phonenumber" placeholder="在此输入密码"></p>
				    <p class="fp-p"><span class="fp-s">确认新密码:</span><input type="text" class="fp-phonenumber" placeholder="在此输入密码"></p>
			         <a class="fp-next" href="javascrpt:;">下一步</a>
			    </div>
			    <div class="fp-step3" style="display: none;">
			    	<div class="fp-paswd-ok">
						<img src="images/bangdingchenggong.png">
						<div class="fp-ok-r">
							<p>登录密码设置成功<a href="login.html">去登录</a></p>
							<p style="color:#CCCCCC;font-size: 0.8em;text-align: left;">请牢记此支付密码</p>
						</div>
				    </div>
			    </div>
			    <!------修改结束-------------->
			</div>

css在这里就不一一列了

<script>
			$(function(){
				$(".fp-step1 .fp-next").click(function(){
					var speed = 1;
					var fp_half=$(".fpwd-top").width()/2;
					bar=setInterval(function(){
						var now_w=parseInt($(".fp-jindu").width());
						if(now_w<=fp_half){
							 barWidth = (now_w + 1)+"px";
							$(".fp-jindu").css("width",barWidth);
						}else{
							clearInterval(bar);
							$(".fp-step-title2 .fp-dcricle").css("border","1px dashed #ffdd00");
							$(".fp-step-title2 .fp-dcricle span").css("background","#FFDD00");
							$(".fp-step1").hide();
							$(".fp-step2").show();
						}
					},speed);
				})
				$(".fp-step2 .fp-next").click(function(){
					var speed = 1;
					var fp_half=$(".fpwd-top").width();
					bar=setInterval(function(){
						var now_w=parseInt($(".fp-jindu").width());
						if(now_w<=fp_half){
							 barWidth = (now_w + 1)+"px";
							$(".fp-jindu").css("width",barWidth);
						}else{
							clearInterval(bar);
							$(".fp-step-title3 .fp-dcricle").css("border","1px dashed #ffdd00");
							$(".fp-step-title3 .fp-dcricle span").css("background","#FFDD00");
							$(".fp-step2").hide();
							$(".fp-step3").show();
						}
					},speed);
				})
			})
		</script>

 

 

 

转载于:https://my.oschina.net/yanyaya/blog/779296

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值