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;
});
});
完美的答案。感謝傾斜:) –