作者ben1597 (魯魯der)
看板Web_Design
標題[問題] jquery animate問題
時間Fri Jan 9 17:20:44 2015
我想做網頁內容click後
經過jquery的animate動畫往左滑
然後再換頁
但現在我一click後就直接換頁
不會等動畫結束
附上程式碼:
$('div').click(function () {
$(this).animate({ 'left': '-1000px' }, 2000);
document.location.href = "Default.aspx";
})
不知道有什麼方法解決
感謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.227.255.80
※ 文章網址: http://www.ptt.cc/bbs/Web_Design/M.1420795246.A.9E1.html
推 tw0517tw: 在換頁那裏加個timeout啊 01/09 17:46
→ onininon: A function to call once the animation is complete. 01/09 18:13
推 aspdoctor: ,2000, function()..... 加個function在時間後面就可以 01/10 00:38
→ aspdoctor: 了 01/10 00:38
→ ben1597: 感謝各位 原來document就有寫了顆顆 01/10 11:15