我有以下代码并尝试在
中生成ajax淡入淡出的结果$.post('e.php', {term: $(this).text()} , function(data) {
$('#dictionary').html(data).fadeIn("slow");
})
这不起作用。我必须如何编辑它,使结果在div
中淡出?
提前致谢
修改
一切正常,除了效果,它不会发生。我看到结果显示在div
中,而不会淡出。
答案 0 :(得分:1)
这可能与在#dictionary
来电之前fadeIn()
可见的事实有关。请参阅this question。
答案 1 :(得分:0)
回应你的评论:
@David是可见的
您希望.fadeIn()
对已经可见的元素做什么?什么都没有“淡入”。首先需要隐藏元素。要么默认情况下通过CSS将其隐藏起来:
#dictionary {
display: none;
}
或者使用JavaScript代码隐藏它:
$('#dictionary').hide().html(data).fadeIn("slow");