【jQuery】How to implement an animation that uses transition to turn translucent text into opaque character by character | Demo page

※Please check using Developer tools

Dummytext01

Sponsored links

HTML

<div class="wrap">
  <p class="text">Dummytext01</p>
</div>

JavaScript

$(function(){
  $('.text').children().addBack().contents().each(function() {
      $(this).replaceWith($(this).text().replace(/(\S)/g, '<span>$&</span>'));
  });
});
$(window).on('load', function(){
  $(".text").addClass("active");
});

CSS

.wrap {
  width: 768px;
  margin: 0 auto;
}

.text {
  margin: 200px 0 0;
  text-align: center;
  font-size: 50px;
}

.text span {
  opacity: 0.5;
}

.text span:nth-child(1) {
  transition: opacity 0.8s ease 0.1s;
}
.text span:nth-child(2) {
  transition: opacity 0.8s ease 0.2s;
}
.text span:nth-child(3) {
  transition: opacity 0.8s ease 0.3s;
}
.text span:nth-child(4) {
  transition: opacity 0.8s ease 0.4s;
}
.text span:nth-child(5) {
  transition: opacity 0.8s ease 0.5s;
}
.text span:nth-child(6) {
  transition: opacity 0.8s ease 0.6s;
}
.text span:nth-child(7) {
  transition:opacity 0.8s ease 0.7s;
}
.text span:nth-child(8) {
  transition: opacity  0.8s ease 0.8s;
}
.text span:nth-child(9) {
  transition: opacity 0.8s ease 0.9s;
}
.text span:nth-child(10) {
  transition: opacity 0.8s ease 1s;
}
.text span:nth-child(11) {
  transition: opacity 0.8s ease 1.1s;
}

.text.active span {
  opacity: 1;
}

@media screen and (max-width:640px){
  .wrap {
    width: 100%;
  }
}