圆环形状的上下都有内容的时间轴的实现方法

1 篇文章 0 订阅
1 篇文章 0 订阅

圆环形状的上下都有内容的时间轴的实现方法

欢迎使用Markdown编辑器

你好! 以下代码便是具体实现方法,实现效果和下图一致,欢迎大家批评指正。
实现风格如本图

圆环形时间轴实现方法

<html>
  <head>
    <meta content="text/html; charset=gbk" http-equiv="content-type">
    <title></title>
    <style type="text/css">
        :after, :before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: content-box;
}
       .linesegs{
        list-style-type: none;
        float:left;
        position: relative;
        background-repeat: repeat-x;
        height: 40px;
        margin:0px;
        padding-left:10px;
      }
      .linesegs li{
      float: left;
      width: 110px;
      position: relative;
      background-repeat: no-repeat;
      }
    .linesegs li .lines {
           height:20px;
           width:100%;
        }
    .linesegs li .dashed:after {
        content: '';
        display: block;
        border-top:2px solid rgb(83, 198, 170);
        width: 100%;
        height: 2px;

    }
    .linesegs li .solid:after {
        content: '';
        display: block;
        border-top:2px solid #D7BB67;
        width: 100%;
        height: 2px;

    }
    .linesegs li .radius:before {
        content: '';
        display: block;
        position: relative;
        width: 6px;
        height: 6px;
        /* background-color: rgb(84, 187, 248); 渠道 */

        background-color: rgb(83, 198, 170);

        border-radius: 50%;
        border: 3px solid white ;
        top:6px;
        left: 45%;

        /* box-shadow: 0 0 0 3px rgb(84, 187, 248) ; */
        box-shadow: 0 0 0 3px rgb(83, 198, 170);  /*HIS*/
    }
     .linesegs li .showtext{
        width:100%;
        height:30%;
        display: inline-block;
        text-align: center;
        position: relative;
        left: 0px;
        top: 10px;
      }
      .linesegs li .startdate{
        width:100%;
        height:1px;
        margin-top:20px;
        font-size:12px;
        text-align: center;
        position: relative;
        left:0px;
        bottom: 25px;
      }
  </style>
  </head>
  <body>
  <div class="content" id="content">

  </div>
  <script type="text/javascript">
          

          var str='[{"title":"张三","linesegs":[{"showtext":"  ","start":"2018-6-3","end":"2018-8-3","shoutype":"0"},{"showtext":"1","start":"2018-8-4","end":"2019-7-5","shoutype":"1"},{"showtext":"2","start":"2019-8-7","end":"2020-7-7","shoutype":"1"}]},{"title":"李四","linesegs":[{"showtext":"1","start":"2018-6-6","end":"2018-10-6","shoutype":"1"}]},{"title":"王五","linesegs":[{"showtext":"2","start":"2018-10-7","end":"2019-10-7","shoutype":"1"}]}]'

var jsonstr=JSON.parse(str);
strhtml='';
for(var i=0;i<jsonstr.length;i++){
//标题,
strhtml+='<div class="contract"> ';
linesegs=jsonstr[i].linesegs

strhtml+='<ul class="linesegs">'
for(var j=0 ;j<linesegs.length;j++){

  strhtml+='<li class="lineseg" style="width:'+100+'px;"> ' ;
  strhtml+='<h3 class="startdate">'+linesegs[j].start+'</h3>';
  //判断是虚线还是实线
  if(linesegs[j].shoutype==0){
   strhtml+=' <div class="dashed radius" ></div>';
  }else{
   strhtml+=' <div class="solid radius" ></div>';
  }

  strhtml+=' <a class="showtext">'+linesegs[j].showtext +' </a> </li>';
}
//最后的结束时间
ends=jsonstr[i].linesegs[jsonstr[i].linesegs.length-1].end;

strhtml+='<li class="lineseg"> <h3 class="startdate">'+'微信支付'+'</br>'+'15.00元'+' </h3> <div class="solid radius" ></div> <a class="showtext">'+'2020-7-7'+'</br>'+'18:45:55'+'</a> </li> </ul> </div>';
break;
}
//写入html
document.getElementById("content").innerHTML=strhtml
//document.getElementsByClassName("content")[0].innerHTML=strhtml
  </script>
  </body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

悦耳心意

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值