2014-01-07 245 views
0

我有一個CSS動畫是這樣的:在CSS動畫之後滾動到錨點?

@-webkit-keyframes flip { 
0% {opacity:1;} 
100% {opacity: 0;} //This could be 90% 
//And here could be frame for 100% which would scroll it down. 
} 

#headercover { 
    -webkit-animation-name:flip; 
-webkit-animation-duration:3s; 
-webkit-animation-timing-function:ease; 
-webkit-animation-delay:1s; 
-webkit-animation-iteration-count:1; 
-webkit-animation-play-state:running; 
-webkit-animation-fill-mode: forwards; 

我希望頁面向下滾動到錨,動畫的最後一幀之後。 我對jQuery或JavaScript沒有太大的經驗,所以你能幫我一把嗎?

請參閱網站:HERE

回答

1
setTimeout(function(){ 
    $('html, body').animate({ 
     scrollTop: $("#elementtoScrollToID").offset().top 
    }, 2000); 
}, 3000); // wait 3000 ms 
+0

你能解釋一下你的代碼了一點?沒有得到它的工作... – Claudio

+0

我有一個語法錯誤,對不起,現在試試。請記住將'''#elementtoScrollToID'''更改爲正確的ID – subZero

+0

讓它工作。實際上是缺少jQuery本身:D – Claudio