本文实例为大家分享了jquery css实现流程进度条的具体代码,供大家参考,具体内容如下
方案1:
方案2:
流程进度条 .div_home{ width: 100%; height: 720px; background: pink; } .div_button{ width: 100%; background: rgba(249, 214, 81, 1); text-align: center; } :root { --progress_div-height: 100px; --progress_div-width: 100%; --progress_div-background: rgba(204,232,207,1); --progress_line-top: 50px; --progress_line-height: 4px; --progress_node-height: 20px; --progress_node-width: 20px; --progress_node-top: -8px; --progress_node-lineHeight: 20px; --progress_text-heigth: 20px; --progress_text-width: 120px; --progress_text-top: -30px; --progress_color-yes: rgba(40 ,200 ,252 ,1); --progress_color-no: rgba(213 ,213 ,213 ,1); } .progress_div{ height: var(--progress_div-height); width: var(--progress_div-width); background: var(--progress_div-background); text-align: center; margin: auto 0; } .progress_line_no{ position: relative; top: var(--progress_line-top); height: var(--progress_line-height); background: var(--progress_color-no); } .progress_line_yes{ height: var(--progress_line-height); background: var(--progress_color-yes); } .progress_node_no{ position: absolute; border-radius: 100%; width: var(--progress_node-width); height: var(--progress_node-height); top: var(--progress_node-top); line-height: var(--progress_node-lineHeight); background: var(--progress_color-no); color: var(--progress_color-no); } .progress_node_yes{ position: absolute; border-radius: 100%; width: var(--progress_node-width); height: var(--progress_node-height); top: var(--progress_node-top); line-height: var(--progress_node-lineHeight); background: var(--progress_color-yes); color: var(--progress_color-yes); } .progress_text{ position: absolute; vertical-align: middle; text-align: center; width: var(--progress_text-width); height: var(--progress_text-heigth); top: var(--progress_text-top); } .progress_node_currentActive{ } 1 2 3 4 5
使用:
1.首先要引入一个jquery.js
2.CSS:
:root开始所有css(css基本上都使用的变量,改样式只需要改:root里的变量值就行)
3.JS:
保留所有js方法
调用loadProgress(1000,2)方法,传入进度条长度、最后一个激活节点下标(0到节点的length-1)
186行设置了整体相对于父级div居中,自己看需求改一下就好
4.标签:
主要就是class="progress_line_no"的div里的所有元素,最里面的两层div就是节点,class="progress_text"的div是文字,它们的父级div是圆点
5.激活节点优先级
loadProgress(width,index)方法传入index为最高级别,其次是div上class="progress_node_currentActive",最后默认0
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



