return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>javascript - How can you use Zepto to call a function when an animation ends? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can you use Zepto to call a function when an animation ends? - Stack Overflow

programmeradmin3浏览0评论

I'm currently writing an application using Zepto and phonegap, and I need to know how to call a function when an animation ends. Unfortunately, I can't really figure it out from the examples given or the documentation. So far, the closest I've been able to e is:

$('img').anim({ translatex: '500px', translatey: '500px', opacity: 1, plete: alert("Hello!") }, 2, 'linear');

Which will trigger the alert before the animation. Does anyone know how to fix this so that the alert will trigger after?

I'm currently writing an application using Zepto and phonegap, and I need to know how to call a function when an animation ends. Unfortunately, I can't really figure it out from the examples given or the documentation. So far, the closest I've been able to e is:

$('img').anim({ translatex: '500px', translatey: '500px', opacity: 1, plete: alert("Hello!") }, 2, 'linear');

Which will trigger the alert before the animation. Does anyone know how to fix this so that the alert will trigger after?

Share Improve this question asked Jan 11, 2012 at 21:28 CSturgessCSturgess 1,5572 gold badges13 silver badges29 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

The callback function should be the last parameter of the anim call and you should wrap the alert in a function expression:

$('img').anim({ 
  translatex: '500px', 
  translatey: '500px', 
  opacity: 1        
}, 2, 'linear', function() { alert("Hello!") } );

One other possibility to help here is webkitTransitionEnd - http://www.cuppadev.co.uk/the-trouble-with-css-transitions/

发布评论

评论列表(0)

  1. 暂无评论