※デベロッパーツール等でソースコードをご確認ください(Please check using Developer tools)
DummyText
<div class="wrap">
<p class="text">DummyText</p>
</div>
$(function(){
$('.text').children().addBack().contents().each(function() {
$(this).replaceWith($(this).text().replace(/(\S)/g, '<span class="text-move">$&</span>'));
});
setTimeout(function(){
$(".text").addClass("active");
},100);
});
.wrap {
width: 768px;
margin: 0 auto;
}
.text {
margin: 50px 0 0;
text-align: center;
font-size: 100px;
}
.text-move {
display: inline-block;
opacity: 0;
transform: translate(-50px);
transition-property: all;
transition-duration: .5s;
transition-timing-function: ease;
will-change: transform;
}
.text-move:nth-child(1) {
transition-delay: 0s;
}
.text-move:nth-child(2) {
transition-delay: 0.02s;
}
.text-move:nth-child(3) {
transition-delay: 0.04s;
}
.text-move:nth-child(4) {
transition-delay: 0.06s;
}
.text-move:nth-child(5) {
transition-delay: 0.08s;
}
.text-move:nth-child(6) {
transition-delay: 0.1s;
}
.text-move:nth-child(7) {
transition-delay: 0.12s;
}
.text-move:nth-child(8) {
transition-delay: 0.14s;
}
.text-move:nth-child(9) {
transition-delay: 0.16s;
}
.text-move:nth-child(10) {
transition-delay: 0.18s;
}
.text-move:nth-child(11) {
transition-delay: 0.2s;
}
.text-move:nth-child(12) {
transition-delay: 0.22s;
}
.text.active .text-move {
opacity: 1;
transform: translate(0);
}
@media screen and (max-width:640px){
.wrap {
width: 100%;
}
.text-move {
font-size: 30px;
}
}