代码之家  ›  专栏  ›  技术社区  ›  karim79

jquery1.4.2-是$(“#foo”).hide(“normal”)坏了还是我疯了?

  •  6
  • karim79  · 技术社区  · 16 年前

    有人知道为什么吗 .hide("normal") 在jQuery1.4.2中似乎不起作用?它是一个错误,是被删除了还是我疯了?我用了几个不同的场景来复制这个。试试这个:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("button").click(function() {
                 $("div.test").hide("normal");
            });
        });
    
    </script>
    </head>
    
    <body>
        <div class="test">Hello this is a test</div>
        <button>Click</button>
    </body>
    </html>
    
    4 回复  |  直到 16 年前
        1
  •  15
  •   Nick Craver    16 年前

    .text != class="test"

    我已经做了100多次了,用同样的话:)

    $("div.test").hide("normal"); 为了解决这个问题。


    更新: 看来 问题出在哪里 "normal" 作为动画速度。

    This is from the jQuery UI forums :

    不同意,并希望在下一次更新中逆转。

        2
  •  6
  •   Matt user129975    16 年前

    Work's for me

    $("button").click(function() {
         $("div.test").hide("normal");
    });
    

    在里面 $(document).ready()

        3
  •  3
  •   karim79    16 年前

    谢谢你的回复。在我的问题中,我包括了我认为相关的标记。然而,出乎意料的是,令人不安的是,最新jqueryui(1.8.0)的加入打破了“常规”。运行下面的程序,它将不起作用。注释掉jqueryui包含,你瞧,它会工作的!

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("button").click(function() {
                 $("div.test").hide("normal");
            });
        });
    
    </script>
    </head>
    
    <body>
        <div class="test">Hello this is a test</div>
        <button>Click</button>
    </body>
    </html>
    
        4
  •  1
  •   ScottE    16 年前