我有这个标签滑块,当你悬停标签时它会移动一点。我希望只有当滑块没有滑出时才会发生这种情况。当它出来时,它不应该悬停。 请参阅此处的工作示例。
滑块滑出时会“打开”类,所以我尝试添加以下代码:
if (!$("#contactContainer").hasClass("open")) {
$("#contactContainer").hover(function() {
$(this).stop(true, true).animate({
"right": "+=30px"
}, 300); }, function() {
$(this).stop(true, true).animate({
"right": "-=30px"
}, 300); });
}
但是,它似乎没有任何区别。打开的滑块在悬停时仍会移动。我该如何解决?