①3秒後にanimatedParent animateOnceを付与させる
②css3-animat-itを使い可視範囲に入ったらアニメーションさせる
③更新時に既に可視範囲に入っている要素はスクロールしなくても自動的に表示させる
③で躓いています。
どうかよろしくお願いいたします。
なお、①はanimation-delayだと可視状態に入ってからなので3秒後になってしまうのでNG。jsにて制御しています。
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <title></title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/css3-animate-it/1.0.3/css/animations.min.css"> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js"></script> <style> section { overflow: hidden; } .asdfg { width: 100%; height: 100vh; background: #ccc; } p { font-size: 14px; color: #000; } .sld, .sld2 { color: transparent; display: inline-block; font-weight: bold; overflow: hidden; position: relative; } .sld.go, .sld2.go { color:#000; } .sld.go::after { background: #c2a96b; bottom: 0; content: ''; display: block; left: 0; position: absolute; right: 0; top: 0; transform: translate(0, 105%); animation-name: abg; animation-duration: 1s; animation-timing-function: cubic-bezier(0.8, 0, 0.170, 1); } @keyframes abg { 0% { transform: translate(105%, 0); } 40%, 60% { transform: translate(0, 0%); } 00% { transform: translate(-100%, 0) } } .sld2.go::after { background: #c2a96b; bottom: 0; content: ''; display: block; left: 0; position: absolute; right: 0; top: 0; transform: translate(0, 105%); animation-name: abg2; animation-duration: 1s; animation-timing-function: cubic-bezier(0.8, 0, 0.170, 1); } @keyframes abg2 { 0% { transform: translate(0, -105%); } 40%, 60% { transform: translate(0, 0%); } 100% { transform: translate(0, 100%) } } .sld span, .sld2 span { opacity: 0; } .sld.go span, .sld2.go span, .sld2 span img { animation-name: dpn; animation-delay: .5s; animation-duration: 0s; animation-timing-function: linear; animation-fill-mode:both; opacity: 0; } .dpn.go { animation-name: dpn; animation-duration: 0.5s; animation-timing-function: linear; opacity: 1; animation-delay: 0s;} @keyframes dpn { from { opacity: 0} to { opacity: 1} } </style> </head> <body> <section> <div class="dy3" data-sequence="300"> <p class="sld animated" data-id="1"><span>aaaa</span></p> <p class="sld animated" data-id="2"><span>aaaa</span></p> <p class="sld animated" data-id="3"><span>aaaa</span></p> <p class="sld2 animated" data-id="4"><span><img src="img/logo.png"></span></p> <p class="sld animated" data-id="4"><span><img src="img/logo.png"></span></p> <p class="sld animated" data-id="5"><span><img src="img/logo.png"></span></p> </div> <div class="asdfg"></div> <div class="dy3" data-sequence="300"> <p class="sld animated" data-id="1"><span>aaaa</span></p> <p class="sld animated" data-id="2"><span>aaaa</span></p> <p class="sld animated" data-id="3"><span>aaaa</span></p> <p class="sld2 animated" data-id="4"><span><img src="img/logo.png"></span></p> <p class="sld animated" data-id="4"><span><img src="img/logo.png"></span></p> <p class="sld animated" data-id="5"><span><img src="img/logo.png"></span></p> </div> <div class="asdfg"></div> <div class="dy3" data-sequence="300"> <p class="sld animated" data-id="1"><span>aaaa</span></p> <p class="sld animated" data-id="2"><span>aaaa</span></p> <p class="sld animated" data-id="3"><span>aaaa</span></p> <p class="sld2 animated" data-id="4"><span><img src="img/logo.png"></span></p> <p class="sld animated" data-id="4"><span><img src="img/logo.png"></span></p> <p class="sld animated" data-id="5"><span><img src="img/logo.png"></span></p> </div> </section> <script src="https://cdnjs.cloudflare.com/ajax/libs/css3-animate-it/1.0.3/js/css3-animate-it.min.js"></script> <script> $('.dy3').delay(3000).queue(function(){ $(this).addClass('animatedParent animateOnce');}) </script> </body> </html>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。