Fade out on the mother div but not on your kids with jQuery

Asked

Viewed 53 times

0

I have this code, but I’d like the #navBar suffer the fadeOut, #menuBt and #hi were always visible, it is possible?

HTML:

<div id="navBar">
    <div id="hi"></div>
    <div id="menuBt"><h3>menu</h3></div>
</div>

jQuery:

$('#navBar').stop().fadeOut(500);
  • I think I’m just taking it out of the #navBar.

  • 2

    http://meta.pt.stackoverflow.com/questions/297/quando-se-deve-colocar-o-nome-da-linguagem-no-t%c3%adtulo/1911#1911

1 answer

3

The only way to do this is by removing the internal nodes from the navBar from within the navBar. One way is to add them after the navBar when the animation is over:

$('#navBar').stop().fadeOut(500,function(){
  $(this).after($(this).children());
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.