user2252219
user2252219

Reputation: 865

FadeToggle with visibility hidden

I'm trying to get #hi to fadeOut. Right now, the fade isn't happening. The div just disappears.

setTimeout(function() {
     $('.project-link-1').css('visibility','hidden').hide().fadeOut(1000);       
}, 3000);

#hi {visibility:visible;}

I know if can just use .animate and opacity:0, but I'd like to keep IE compatibility.

Upvotes: 0

Views: 394

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

Because you are using hide() then fade

setTimeout(function() {
  $('.project-link-1').fadeTo(1000, 0, function() {
    $(this).css('visibility', 'hidden')
  });
}, 3000);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="project-link-1">project-link-1</div>


If you just want to hide the element after fading

setTimeout(function() {
  $('.project-link-1').fadeOut(1000);
}, 3000);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="project-link-1">project-link-1</div>

Upvotes: 1

Related Questions