【jQuery】テキストを一文字ずつ下から生えてくるようにフェードインさせるテクニックのデモページ/Make text fade in from bottom to top

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

DummyText01

スポンサーリンク

CSS

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

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

.text p {
  display: inline-block;
  transform-origin: center center;
  transform: translate3d(0, 40px, 0);
}

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

.text.active {
  opacity: 1;
}

.text.active p {
  transform: translate3d(0, 0, 0);
}

.text.active span {
  display: block;
  transform: scale3d(1, 1, 1);
  opacity: 1;
}

@media screen and (max-width:640px){
  .wrap {
    width: 100%;
  }
  .text-move {
    font-size: 30px;
  }
}

JavaScript

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