我的任务要求我只使用jquery。看起来不实际,但我是有限的。我能够弄清楚如何做悬停状态,但是当样式被应用时,它仍然存在。所以看看这个..如何用jQuery反转悬停状态?
$(".cta-button").css({
background: "#476887",
"text-align": "center",
width: "173px",
height: "40px",
margin: "62px auto 33px",
cursor: "pointer"
});
$(".cta-button").hover(function() {
$(this).css("background-color", "#509de5");
});
当然,当我不再徘徊,我想它恢复到它的原始背景颜色。我如何去做这件事?谢谢!!
https://api.jquery.com/hover/ –
你阅读文档都什么呢? 'hover()'接受**两个**函数,一个用于鼠标进入,另一个用于鼠标离开。 – adeneo
阅读库的文档.... – epascarello