1 回答
TA贡献1998条经验 获得超6个赞
您对函数和退出元素使用相同的名称。
您将它从 -100px 移动到 100px,这意味着 200px,这会导致文本超出屏幕
var exitB = document.getElementsByClassName("exitButton")[0];
exitB.onmouseenter = function exit(){
var exitA = document.getElementById("exitA");
exitA.style.transform = "translateX(0)";
}
.exitBox{
display: inline;
position: fixed;
top: 20px;
left: 40px;
overflow: hidden;
}
.exitButton svg{
width: 20px;
color: black;
}
#exitA{
display: inline-block;
text-decoration: none;
color: black;
font-size: 30px;
letter-spacing: 2px;
font-family: Teko;
transform: translateX(-100px);
}
<div class="exitBox">
<span class="exitButton"><div>hover</div></span>
<span class="exit"><a href="#" id="exitA">SAIR</a></span>
</div>
添加回答
举报