[Day22] Follow Along Links

[Day22] Follow Along Links

需要用到的技巧与练习目标

1.getBoundingClientRect


const triggers = document.querySelectorAll('a');
const highlight = document.createElement('span');
hightight.classList.add('highlight');
doccument.body.append(highlight);

function highlightLink(){
const linkCoords = this.getBonudingClientRect();
const coords={

width:linkCoords.width,
height:linkCoords.height,
top:linkCoords.top + window.scrollY,
left:linkCoords.left +window.scrollX
};

higtlight.style.width=`${coords.width}px`;
higtlight.style.height=`${coords.height}px`;
higtlight.style.transform=`translate(${coords.left}px, ${coords.top}px)`
}
tiggers.forEach(a => a.addEventListener('mouseenter',highlightLink))

参考资料来源:

  1. https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect

<<:  Day 21 民生公共物联网资料应用竞赛 线稿转精稿

>>:  三种时间长短,让你简单培养习惯

[Day 22] 实作 Database Plugin 整合 Exposed ORM, HikariCP 及 Flyway

Java Web 框架通常都至少整合一种 ORM,只要 Gradle depenency 加一下,再...

Day08 - Python虚拟环境

在前面几天的练习中,我们都直接在本机安装套件,但实际工作上做系统维运时,因各系统开发年份、技术需求等...

愿Alex老师安息,一路好走!

Alex老师是为台湾CISSP资安教育训练开创新局的好老师! 愿Alex老师安息,一路好走! Al...

OSI 模型,教科书中的框架

今天来看看 TCP/IP 之後所提出,有着更完善架构的 OSI,到底有哪些规范吧! OSI 七层 O...

Day01 - 目前才看到第三章 Object

this&Object Prototype Ch3 Object 我的天,真的太久没翻你,试...