Fade out on the div but not on your children with jQuery

0

I have this code, but I would like #navBar to suffer fadeOut, #menuBt and #hi to be always visible, is it possible?

HTML:

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

jQuery:

$('#navBar').stop().fadeOut(500);
    
asked by anonymous 14.11.2014 / 13:28

1 answer

3

The only way to do this is to remove the inner nodes to navBar from within navBar . One way is to add them after navBar when the animation finishes:

$('#navBar').stop().fadeOut(500,function(){
  $(this).after($(this).children());
});
    
14.11.2014 / 13:52