0
我正在使用它来显示.antwort并将动画应用于其不透明度。这工作正常。但是,再次点击.antwort会在没有任何动画的情况下立即隐藏。我究竟做错了什么?使用jQuery来设置动画然后隐藏元素
jQuery(document).ready(function ($) {
$(".frage li").click(function() {
if (!$(this).find(".antwort").is(".open")) {
$(this).find(".antwort").css({
display: "block"
});
$(this).find(".antwort").animate({
opacity: 1
}, 1500).addClass('open');
} else {
$(this).find(".antwort").animate({
opacity: 0
}, 1500).removeClass('open');
$(this).find(".antwort").css({
display: "none"
});
}
return false;
});
});
完美的答案。感谢倾斜:) –