jquery fade effect not working in FF

倾然丶 夕夏残阳落幕 提交于 2020-01-14 22:51:33

问题


This piece of code fades the div fine in IE. In Firefox 3.0.8, the fade time goes by and the div disappears instantly. I can't find anyone mentioning this problem.

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


<div id="show">this is where to show it</div>

回答1:


I've been banging my head against this problem all morning and finally found my problem... the header to "Scripts/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
 */

when they say "You should not use this file at runtime inside the browser" they certainly do mean it...

so make sure you are using the non -vsdoc versions of jquery and jquery-min




回答2:


Thanks for the help.

I found the problem. My example wasn't complete. I had also included jquery-vsdoc.js for jQuery VS intellisense. Taking this out made it work.

I used this trick for future readers

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

Wierd.




回答3:


It is working for me on Firefox 3.0.8 and Windows XP.

Here is the sample page I tested it on.




回答4:


Working for me as well

<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>



回答5:


I was banging my head around this for a long time. My code didn't even have anything to do with any jquery-vsdoc.js.

Solution: Just close the browser, reopen it, load the page again.

Not sure why the heck it wasn't working.

Don't let yourself go crazy like I did!




回答6:


My problem was that I tried to do the animation in CSS first and left this in which caused problems doing it in jQuery.

    transition:.5s linear;



回答7:


You have to put event.preventDefault() there in order to make it work.

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


<div id="show">this is where to show it</div>


来源:https://stackoverflow.com/questions/748113/jquery-fade-effect-not-working-in-ff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!