This is probably best illustrated with an example. I have a parent and a child. The parent is hidden by default unless it has an in class. Its child should transition its background-color from green to white, after a 3s delay, only once the parent receives the in class.
So when the parent is shown, the child's background color is already white. There's no 3 second period of orange, with a transition to white. Can someone explain what's happening here?
$('button.show').on('click', () => {
  $('.parent').addClass('in');
});
$('button.hide').on('click', () => {
  $('.parent').removeClass('in');
});.parent, .child {
  display: flex;
  align-items: center;
  justify-content: center;
}
.parent {
  background-color: orange;
  width: 300px;
  height: 300px;
}
.child {
  background-color: green;
  padding: 20px;
  width: 150px;
  height: 150px;
  transition: background-color 1s linear;
}
.parent:not(.in) {
  display: none;
}
.parent.in .child {
  background-color: white;
  transition-delay: 3s;
}<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="parent">
  <div class="child">
    <span>Background should start green, then turn white, but transition isn't happening.</span>
  </div>
</div>
<br>
<button type="button" class="show">Show parent</button>
<button type="button" class="hide">Hide parent</button> 
     
    