【jQuery】半透明のテキストを一文字ずつ不透明な状態にアニメーションさせるテクニックのデモページ/Make translucent text animated in an opaque state one character at a time(Demo page)

※デベロッパーツール等でソースコードをご確認ください

Dummytext01

スポンサーリンク

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%;
  }
}
  

JavaScript

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