这件代码在IE中淡出了div。在Firefox 3.0.8中,淡入淡出时间,DIV立即消失。我找不到有人提到这个问题。

   $(function() {
            $("#show").click(function() {
                $("#show").fadeOut('slow');
            });
        });


<div id="show">this is where to show it</div>
有帮助吗?

解决方案 2

谢谢您的帮助。

我发现了这个问题。我的例子还不完整。我还包括 jquery-vsdoc.js 对于jQuery vs Intellisense。把它拿出来使它起作用。

我为未来的读者使用了这个技巧

<%if (false) { %>
<script src="common/jquery-vsdoc.js" type="text/javascript"></script>
<% } %>

Wierd。

其他提示

我整个早晨都一直在面对这个问题,终于找到了我的问题……标题是“脚本/jquery-1.3.2-vsdoc.js”

/*
 * This file has been commented to support Visual Studio Intellisense.
 * You should not use this file at runtime inside the browser--it is only
 * intended to be used only for design-time IntelliSense.  Please use the
 * standard jQuery library for all production use.
 *
 * Comment version: 1.3.2a
 */

当他们说的时候 “您不应在浏览器内的运行时使用此文件” 他们当然确实意味着...

因此,请确保您正在使用jQuery和jQuery -min的非VSDOC版本

它在Firefox 3.0.8和Windows XP上为我工作。

这是我对其进行测试的示例页面。

也为我工作

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript">
</script>

<script type="text/javascript">
 $(function() {
            $("#show").click(function() {
                $("#show").fadeOut('slow');
            });
        });
</script>
   <div id="show">this is where to show it</div>

我很长一段时间以来一直围着这个问题。我的代码甚至与任何jQuery-vsdoc.js都没有任何关系。

解决方案:只需关闭浏览器,重新打开它,再次加载页面即可。

不知道为什么它不起作用。

不要让自己像我一样发疯!

我的问题是我试图先在CSS中进行动画,并在此造成问题的问题。

    transition:.5s linear;

您必须将event.preventdefault()放在那里才能使其正常工作。

$(function() {
     $("#show").click(function(event) {
        event.preventDefault();
        $("#show").fadeOut('slow');
     });
 });


<div id="show">this is where to show it</div>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top