Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
738 views
in Technique[技术] by (71.8m points)

html - jQuery fadeIn() on display none

I have a div where I did a $('#div').css('display', 'none');

Now, to bring this item back, I want to fade it in. However, it seems like $('#div').fadeIn() is not doing it, but I don't want to set display back to block, as if I do it just re-appears instantly instead of fading.. any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try

$('#div').hide();

to hide the element.

Update: I suggested this because I came a problem with setting .css('display', 'none') on the body in Firefox. But it should work for other elements.

But if it does not work with hide() then you definitely have another problem and you have to post more code or provide a demo.

In which browser does it fail? Are you sure $('#div').fadeIn() is executed?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...