【发布时间】:2015-03-20 17:07:15
【问题描述】:
我制作了一个脚本,用于在将鼠标悬停在其中的 a 元素上后为菜单 li 元素设置动画。
一切正常,但我想要别的东西。只要鼠标悬停在 a 元素上,我希望效果不会消失,而是一直存在。
使用什么功能?
到目前为止的脚本:
jQuery(document).ready(function($){
$(".main-navigation a").mouseover(function() {
$(this).parent().animate({
backgroundColor: "green"
}, "normal"),
$(this).parent().animate({
backgroundColor: "transparent"
})
.mouseleave(function() {
$(this).parent().animate({
backgroundColor: "transparent"
}, "normal")
});
});
});
【问题讨论】:
-
您可以在 IE9+ 中仅使用 CSS3 完成此操作。
-
我已经设法为你创建了一个完整的 Jquery 解决方案,让你自己失望:P
标签: javascript jquery html css jquery-animate