作者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://webptt.com/cn.aspx?n=bbs/Web_Design/M.1420795246.A.9E1.html
1F:推 tw0517tw: 在换页那里加个timeout啊 01/09 17:46
3F:→ onininon: A function to call once the animation is complete. 01/09 18:13
4F:推 aspdoctor: ,2000, function()..... 加个function在时间後面就可以 01/10 00:38
5F:→ aspdoctor: 了 01/10 00:38
6F:→ ben1597: 感谢各位 原来document就有写了颗颗 01/10 11:15