凭借我有限的jQuery技能,我设法根据导航悬停移动导航滑块。但是我觉得我的代码不是最优的,并且在导航项之间快速移动时的延迟太长。 (减少我的JavaScript中的延迟没有帮助)。有什么想法或建议吗?
$('#navTop .home').mouseover(function () {
$('.navSlider').animate({
marginLeft: '54px',
}, 200, function () {
// Animation complete.
});
});
...
答案 0 :(得分:2)
http://jsfiddle.net/mohammadAdil/wTcnV/1/
您需要像这样致电.stop()
-
$('.navSlider').stop().animate({
marginLeft: '54px',
}, 300, function () {
// Animation complete.
});
答案 1 :(得分:0)