【问题标题】:Simple Multiple Step简单的多步骤
【发布时间】:2014-10-16 16:12:34
【问题描述】:

JSfiddle DEMO

HTML

<div id="status-buttons" class="text-center">
  <a href="/1"><span>1</span></a>
  <a href="/2"><span>2</span></a>
  <a href="/3"><span>3</span></a>
</div>

CSS

#status-buttons a {
    display:inline-block;
  font-size: 22px;
  margin-right: 20px; }
  #status-buttons a span {
    color: white;
    line-height: 60px;
    padding-top: 5px; 
}

#status-buttons a.active span {
  background: #00BC8C; }

.circle, #status-buttons a {
  width: 56px;
  height: 56px;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  -ms-border-radius: 50%;
  border-radius: 50%;
  background: #5dc5c5;
  margin-right: 10px; 
  text-align:center;

}

尝试了圈子。如图所示,我被圆圈之间的线条卡住了。尝试添加边框底部,它没有出现。不认为 div 中的宽度对线条有用吗?有什么办法可以解决这个问题,所以当点击圆圈上的不同链接时,圆圈的数量和它的线条会有活动的类?

另一个问题:假设链接将我们带到不同形式的不同页面,是否可以使圈子活跃?只有我能想到的方法是让每个页面中的圆圈都处于活动状态,所以如果单击任何链接页面,例如单击 #2,它将显示 1 和 2 个圆圈处于活动状态。这可能是一个骗局。还有其他更好的方法吗?

帮助表示赞赏。

【问题讨论】:

  • 这个怎么样:jsfiddle.net/zyvke8sy 它有点受限,因为伪元素有一个固定的宽度......

标签: jquery css


【解决方案1】:

我最近做了类似的事情。

.progressbar {
        margin-top: 40px;
        margin-bottom: 30px;
        overflow: hidden;
        counter-reset: step; 
    }
    .progressbar li {
        list-style-type: none;
        color: #555555;
        text-transform: uppercase;
        text-align: center;
        font-size: 9px;
        width: 20%;
        float: left;
        position: relative; 
    }
    .progressbar li:before {
        content: counter(step);
        counter-increment: step;
        width: 20px;
        line-height: 20px;
        display: block;
        font-size: 10px;
        color: #333;
        background: #bfbfbf;
        border-radius: 20px;
        margin: 0 auto 5px auto; 
    }
    .progressbar li:after {
        content: '';
        width: 100%;
        height: 2px;
        background: #bfbfbf;
        position: absolute;
        left: -50%;
        top: 9px;
        margin-left: 5px;
        z-index: -1; 
    }
    .progressbar li:first-child:after {
        content: none; 
    }
    .progressbar li.stepped {
        color: #900028;
        font-weight: bold; 
    }
    .progressbar li.stepped:before, 
    .progressbar li.stepped:after{
        background: #900028;
        color: white; 
    }

    
<ul class="progressbar">
      <li class="stepped">Step 1</li>
      <li class="stepped">Step 2</li>
      <li class="stepped">Step 3</li>
      <li>Step 4</li>
      <li>Step 5</li>
    </ul>

(信用:http://thecodeplayer.com/walkthrough/jquery-multi-step-form-with-progress-bar

【讨论】:

  • 我看到了类似的,但是我尝试修改为圆形,看起来不太好。唔。将不得不再试一次
  • 要使它们成为圆形,只需使边框半径、宽度和高度都相同。更新了我的答案,让他们成为圈子
  • 我意识到您在 li 中使用文本,而我的是链接。所以我看到每个数字有 2 个:1 1、2 2、3 3、4 4 - 更新小提琴:jsfiddle.net/gohuomcc/1
  • 我为麻烦道歉,但是如何将线向下移动,因为我让圈子变大了。这条线不合适
  • 所以数字是由css step属性生成的。如果您需要将里面的数字链接起来,您应该将li:before更改为li a并删除content: counter(step); counter-increment: step;,您也可以删除counter-reset: step;。至于调整线,由li:after中的top属性控制。更新了你的小提琴jsfiddle.net/gohuomcc/5
猜你喜欢
  • 2019-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-19
相关资源
最近更新 更多