How can I make a jquery/css progression bar that reflects step by step form progression?

情到浓时终转凉″ 提交于 2019-12-04 20:14:46

If you like the Buffalo one, just have a look at how they do it.

First they define a div like this:

<div id="progress">
    <div id="complete" class="s1">
        <div id="marker"></div>
    </div>
</div>

Then they use CSS to render the div based on the progress (which is controlled with class="s1" and so on).

/**
 * PROGRESS
 */
#progress,#complete {
    width: 520px;
    margin: 1px 0 19px;
    height: 32px;
    background:url(/img/backgrounds/progress.png);
    position:relative;
}
#complete {
    background-position: 0px 57px;
    margin-top: 0;
}
#complete #marker {
    position: absolute;
    top: 0;
    right: -26px;
    background:url(/img/backgrounds/markers.png);
    width: 26px;
    height: 32px;
}
#progress .s1 {
    width: 19px;
}
#progress .s2 {
    width:111px;
}
#progress .s3 {
    width:203px;
}
#progress .s4 {
    width:295px;
}
#progress .s5 {
    width:386px;
}
#progress .s6 {
    width:478px;
}
#progress .s2 #marker {
    background-position: -26px 0;
}
#progress .s3 #marker {
    background-position: -52px 0;
}
#progress .s4 #marker {
    background-position: -78px 0;
}
#progress .s5 #marker {
    background-position: -104px 0;
}
#progress .s6 #marker {
    background-position: -130px 0;
}

The CSS manipulates images to show the desired state

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!