1 回答

TA貢獻1829條經驗 獲得超9個贊
將你的第二部分放入一個單獨的函數中,然后使用settimeout(你可以自己調整時間)
$('#startButton').on('click', function() {
// run animation on click
document.getElementById("rightHand").animate([
{ transform: 'translateY(80px)' },
{ transform: 'translateY(0px)' }
], {
duration: 100
});
// say after 3 seconds to trigger secondpart
setTimeout(function(){ secondpart(); }, 3000);
});
function secondpart()
{
//run second part
$('#portfolio').show();
$('.footer').show();
var hash = $('#portfolioSection');
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800);
}
添加回答
舉報