0

I'm having characters move into place with the transform function, and using opacity to make them appear during the translation. Currently, the 3.5 second transition is working on the opacity function, but not on the transform function. Which gives a result of the characters sitting in their end positions instead of moving. Before I remove the function with jquery the characters are in the correct starting spots, so I don't know if I'm overriding the translate function with another part of the code.

I have tried using translate3d and made sure that the elements in the list are in "display: inline-block". Here's a link to why it needs to be block format. I found it here. There are no other inherited traits in other part of the code.

Here is the html and jquery:

<div class="intro-section">
  <div class="intro-wrap">
    <ul id="intro-list" class="intro-text content-hidden">
      <li>W</li>
      <li>E</li>
      <li>L</li>
      <li>C</li>
      <li>O</li>
      <li>M</li>
      <li>E</li>
    </ul>
  </div>
</div>

<script type="text/javascript">

  $(function() { 

    setTimeout(function() {
      $('.intro-text').removeClass('content-hidden');
    }, 500);

  });

</script>

Here is the css. As you can see I tried both translateY and translate3d, neither worked:

.intro-text { 
  list-style: none;
}

.intro-text li {
  display: inline-block;
  margin-right: 50px;
  font-family: '28Days';
  font-weight: 300;
  font-size: 4em;
  color: white;
  opacity: 1;
  transition: opacity 3.5s ease;
}

.intro-text li:last-child {
  margin-right: 0;
}

.content-hidden li { 
  opacity: 0; 
}

.content-hidden li:nth-child(1) { transform: translateY(100px);}
.content-hidden li:nth-child(2) { transform: translate3d(0, -100px, 0);}
.content-hidden li:nth-child(3) { transform: translate3d(0, 100px, 0);}
.content-hidden li:nth-child(4) { transform: translate3d(0, -100px, 0);}
.content-hidden li:nth-child(5) { transform: translate3d(0, 100px, 0);}
.content-hidden li:nth-child(6) { transform: translate3d(0, -100px, 0);}
.content-hidden li:nth-child(7) { transform: translate3d(0, 100px, 0);}

I'd like the characters to move into place too rather than just sit where they are supposed to end and fade in. Thanks!

1 Answers1

0

Your code seems to work quite well.

I just added a transition for the transform, and set the color to not be white, and it looks ok to me. Check the below snippet:

$(function() { 

    setTimeout(function() {
      $('.intro-text').removeClass('content-hidden');
    }, 500);

  });
.intro-text { 
  list-style: none;
}

.intro-text li {
  display: inline-block;
  margin-right: 40px;
  font-family: '28Days';
  font-weight: 300;
  font-size: 4em;
  color: red;
  opacity: 1;
  transition: opacity 3.5s ease, transform 3.5s ease;
}

.intro-text li:last-child {
  margin-right: 0;
}

.content-hidden li { 
  opacity: 0; 
}

.content-hidden li:nth-child(1) { transform: translateY(100px);}
.content-hidden li:nth-child(2) { transform: translate3d(0, -100px, 0);}
.content-hidden li:nth-child(3) { transform: translate3d(0, 100px, 0);}
.content-hidden li:nth-child(4) { transform: translate3d(0, -100px, 0);}
.content-hidden li:nth-child(5) { transform: translate3d(0, 100px, 0);}
.content-hidden li:nth-child(6) { transform: translate3d(0, -100px, 0);}
.content-hidden li:nth-child(7) { transform: translate3d(0, 100px, 0);}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="intro-section">
  <div class="intro-wrap">
    <ul id="intro-list" class="intro-text content-hidden">
      <li>W</li>
      <li>E</li>
      <li>L</li>
      <li>C</li>
      <li>O</li>
      <li>M</li>
      <li>E</li>
    </ul>
  </div>
</div>
vals
  • 61,425
  • 11
  • 89
  • 138