如何使用 jquery 为嵌套元素设置动画?我一直在尝试使用 jquery 使表可见几个小时,但它不起作用。注释掉了
//document.getElementById("passwordCon").style.visibility="visible";
工作得很好,但我想把它做成动画。怎么了!!!我尝试使用 animate 函数和 Visibility:visible 但没有任何效果。 id 引用表 id。
编辑:表格的html样式属性是visibility:hidden。我想通过 jquery 和动画显示表格。
JavaScript
$(document).ready(function(){
$("#username").keyup(function(){
$.post("tryUser.php",
{
name:$(this).serialize()
},
function(data){
if(data == "no")
{
//document.getElementById("passwordCon").style.visibility="visible";
$("#passwordCon").fadeIn(500);
}
else
{
document.getElementById("passwordConfTitle").style.visibility="hidden";
document.getElementById("passwordCon").style.visibility="hidden";
}
});
});
});
最佳答案
尝试使用隐藏:
$("#passwordCon").hide(1000);
您可以检查示例代码:
http://w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_slow
关于jquery - 如何使用 jquery 为嵌套元素设置动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17141492/