如何在HTML中设计步骤进度条,前端css实现步骤条,进度条

这是一个关于前端开发的代码示例,展示了如何创建一个带有步骤状态的进度条。代码详细定义了样式类,用于呈现不同步骤的状态,如活动状态和非活动状态。此外,还包含JavaScript逻辑来根据当前步骤激活相应的进度条元素。该示例适用于网页中的订单流程跟踪或其他类似进度指示场景。
摘要由CSDN通过智能技术生成

效果图

e1c172ab6388?utm_campaign=maleskine&utm_content=note&utm_medium=writer_share&utm_source=weibo

代码

Document

/*进度条start*/

.order_status {

height: 175px;

padding-top: 90px;

padding-left: 160px

}

.order_status .s-step {

float: left;

width: 170px;

height: 60px;

position: relative;

}

.order_status .s-step:nth-child(5n) {

width: 0px;

}

.order_status .s-step.active {

float: left;

width: 170px;

height: 60px;

position: relative;

}

.order_status .s-step>b>b.active {

background-color: #337ab7

}

.order_status .s-step>b {

display: block;

width: 32px;

height: 32px;

line-height: 32px;

border-radius: 32px;

position: absolute;

margin-left: -16px;

top: -20px;

z-index: 87

}

.order_status .s-step>b>b {

display: block;

width: 26px;

height: 26px;

line-height: 26px;

border-radius: 26px;

background: #ccc;

margin-top: 3px;

margin-left: 3px;

z-index: 88

}

.order_status .s-step>p {

width: 161px;

border: 1px dashed #ddd;

top: -20px;

position: absolute;

z-index: 86

}

.order_status .s-step>p.active {

width: 161px;

border: 1px dashed #337ab7;

top: -20px;

position: absolute;

z-index: 86

}

.order_status .s-step em {

display: block;

padding-top: 20px;

font-style: normal;

text-align: center;

color: #b7b7b7;

font-size: 12px;

margin-left: -65px;

width: 130px

}

.order_status .s-step>div {

display: block;

width: 80px;

height: 32px;

line-height: 32px;

position: absolute;

margin-left: -40px;

top: -55px;

z-index: 87;

text-align: center;

font-size: 12px;

color: #c9c4c4

}

.order_status .s-step>div.active {

display: block;

width: 80px;

height: 32px;

line-height: 32px;

position: absolute;

margin-left: -40px;

top: -55px;

z-index: 87;

text-align: center;

font-size: 12px;

color: #337ab7

}

/*步骤条end*/

2017-05-05 10:01:05

下发订单

2017-05-06 10:01:05

接受订单

2017-05-07 10:01:05

提交订单

2017-05-08 10:01:05

审核通过

2017-05-09 10:01:05

订单完成

//步骤条

if ($(".s-step0").hasClass("active")) {

$(".s-step0>b>b,.s-step0>div").addClass("active");

$(".s-step1>em,.s-step2>em,.s-step3>em,.s-step4>em").hide();

}

else if ($(".s-step1").hasClass("active")) {

$(".s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");

$(".s-step2>em,.s-step3>em,.s-step4>em").hide();

}

else if ($(".s-step2").hasClass("active")) {

$(".s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");

$(".s-step3>em,.s-step4>em").hide();

}

else if ($(".s-step3").hasClass("active")) {

$(".s-step3>b>b,.s-step3>div,.s-step2>p,.s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");

$(".s-step4>em").hide();

}

else {

$(".s-step4>b>b,.s-step4>div,.s-step3>p,.s-step3>b>b,.s-step3>div,.s-step2>p,.s-step2>b>b,.s-step2>div,.s-step1>p,.s-step1>b>b,.s-step1>div,.s-step0>b>b,.s-step0>p,.s-step0>div").addClass("active");

}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值