SOURCE

console 命令行工具 X clear

                    
>
console
// 获取所有的节点
var divList = Array.from(document.querySelectorAll('div'))
// 用来高亮的节点
var hightlight = document.querySelector('.hightlight')
// 手指一开始命中的那个节点
var lastChild = null
// 来自于lastChild,在手指离开之前,都是克隆的
var currentChild = null
// 要添加到的那个父节点
var needAppendParent = null
// 用来初始化每一个节点的边距,不要每次去算,触发回流
function init() {
    divList.forEach(item => {
        var bound = item.getBoundingClientRect()
        item.bound = JSON.parse(JSON.stringify(bound))
    })
}
init()

/*
	手指移上去时,克隆命中的这个节点,并且这是它当前的位置,
	为手指移上去的位置,
	显示当前的hightlight命中了哪个
  */
  document.body.addEventListener('touchstart', function(e) {
    lastChild = e.target
    currentChild = e.target.cloneNode(true)
    currentChild.style.cssText = `position:absolute;left:${e.targetTouches[0].pageX }px;top:${e.targetTouches[0].pageY}px;`
    document.body.appendChild(currentChild)
    hightlight.style.cssText = `display:block;left:${lastChild.bound.left}px;top:${lastChild.bound.top}px;width:${lastChild.bound.width}px;height:${lastChild.bound.height}px;`
  })
<div>1111</div>
<div>2222</div>
<div>3333</div>
<div>4444</div>
<div>5555</div>
<div class="hightlight"></div>
    .tabs {
    .tabs-nav-wrap {
        position: relative;
        border-bottom: 1px solid #dcdee2;
        margin-bottom: 16px;
    }
    .tabs-tab {
        position: relative;
        display: inline-block;
        margin-right: 16px;
        padding: 8px 16px;
        cursor: pointer;
    }
    .tabs-inv-bar {
        position: absolute;
        left: 0;
        bottom: 0;
        background-color: #2d8cf0;
        height: 2px;
        transition: transform 300ms ease-in-out;
    }
    .tabs-nav-scroll {
        overflow: hidden;
        white-space: nowrap;
    }
    .tabs-nav {
        position: relative;
        float: left;
        transition: transform 0.5s ease-in-out;
    }
    .tabs-nav-prev,
    .tabs-nav-next {
        position: absolute;
        width: 32px;
        line-height: 32px;
        text-align: center;
        cursor: pointer;
    }
    .tabs-nav-prev {
        left: 0;
    }
    .tabs-nav-next {
        right: 0;
    }
    .tabs-nav-scrollable {
        padding: 0 32px;
    }
    .tabs-nav-scroll-disabled {
        display: none;
    }

本项目引用的自定义外部资源