js实现流程箭头

2 篇文章 0 订阅

实现流程箭头

因为箭头柱体高度要动态,所以用图片不合适,就使用css+js
箭头就分为柱体、三角、横线(不用伪元素原因为发现js修改伪元素样式麻烦,故用i元素)
css
html

<span class='flownametd_infoicon leftnone'><i class='iconbefore'></i><i class='iconline'></i><i class='iconafter'></i></span></span>
flownametd_infoicon .iconafter{
    content: '';
    position: absolute;
    display: inline-block;
    width: 9px;
    /* height: 100%; */
    height: 15px;
    border: 1px solid #C9A57C;
    border-bottom: none;
    left: -5px;
    background: #F9F6F0;
  
}
.flownametd_infoicon .iconbefore{
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid #C9A57C;
    border-left: none;
    border-top: none;
    /* bottom: -100%; */
    bottom: -21px;
    left: -6px;
    z-index: 1;
    transform: translateX(-0%) rotate(45deg);
}
.flownametd_infoicon .iconline{
    content: '';
    position: absolute;
    width: 17px;
    height: 1px;
    background: #C9A57C;
    /* bottom: -100%; */
    bottom: -16px;
    left: -8px;
}

js

 				var dowmiconList=$(".flownametd_infoicon").parents("tr");
                    for(var k=dowmiconList.length-1;k>0;k--){
                        if(dowmiconList[k]){
                            // 当前tr 下一个tr
                            let currentop=$(dowmiconList[k]).find(".block_borderSg").offset().top;
                            let nextop=$(dowmiconList[k-1]).find(".block_borderSg").offset().top;
                            //设置柱体高度 (nextop-currentop)-固定 三角固定12bottom -(柱体高度+固定6)  横线bottom-柱体高度
                            if(nextop-currentop){
                                // console.log(currentop,nextop,nextop-currentop);
                                let barheight=nextop-currentop-37;
                                let trianglebottom=-(barheight+6);
                                $(dowmiconList[k]).find(".iconafter").css({ "height": barheight+'px' });
                                $(dowmiconList[k]).find(".iconbefore").css({ "bottom": trianglebottom+'px' });
                                $(dowmiconList[k]).find(".iconline").css({ "bottom": -(barheight+1)+'px' });
                            }
                        }
                    }

效果图
在这里插入图片描述
觉得有帮助可以打赏的 ,哈哈哈哈哈

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值