jquery - 如何使用 jquery 为嵌套元素设置动画?

标签 jquery animation selector

如何使用 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

http://w3schools.com/jquery/jquery_hide_show.asp

关于jquery - 如何使用 jquery 为嵌套元素设置动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17141492/

相关文章:

c# - 微妙的 WP7 枢轴 ListViewItem 动画

python-2.7 - 如何从选择器中获取一个元素

$(this).find (':nth-child(2)' 上的 jquery 选择器混合)

css - 悬停时更改列背景颜色

php - UTF8 character_set_server 和 DataTables 插件

仅用于将 + 符号附加到 span 类的第一个实例的 jQuery 选择器

javascript - 将使用 jquery add_function 创建的多个输入数据插入到 mysql 中

jquery - 相当于 D3 中的 jQuery .offset().top

javascript - 在动画元素期间降低速度

Javascript setInterval 连续多行