Want to use jquery fade in effects, but want to us

2020-04-05 08:05发布

It seems most of the jquery fadein/out and animate functions are based on the initial element having display:none as opposed to visibility:hidden.

What if I want the initial element to take space up on the page (i.e. use visibility:hidden), but then use a fade in/out or slide effect? Is there an easy way to do this?

标签: jquery
2条回答
Summer. ? 凉城
2楼-- · 2020-04-05 08:40

You may also try something like this (Demo) as fadeIn

$('div').css({opacity: 0, visibility: "visible"}).animate({opacity: 1}, 'slow');
查看更多
Explosion°爆炸
3楼-- · 2020-04-05 08:45

Sure, start with visibility: hidden then do:

$('.your-element').css('visibility','visible').hide().fadeIn();

Borrowed from a very similar question.

查看更多
登录 后发表回答