简体   繁体   English

jQuery绑定到css3转换发生

[英]jQuery bind to css3 transition occuring

So far in my research the only css3 transition event I've found is transitionEnd. 到目前为止,在我的研究中,我发现的唯一的css3过渡事件是transitionEnd。 What I would like to do is bind a javascript function to an element to be constantly re-fired while a transition is occurring. 我想要做的是将一个javascript函数绑定到一个元素,以便在转换发生时不断重新触发。 Think $(window).resize but for an element being resized with a css3 transition. 想想$(window).resize但是对于使用css3过渡调整大小的元素。

Is this possible? 这可能吗? I have found no transitionStart, transitionAnimation or anything else that would allow me to detect, the start of, or the time when, a transition is occurring. 我没有找到transitionStart,transitionAnimation或任何其他允许我检测,转换开始或转换发生的时间。

I would prefer jQuery's bindings, but other methods are fine. 我更喜欢jQuery的绑定,但其他方法也可以。 Also this needs to work in FF, Chrome, Safari and Opera. 此外,这需要在FF,Chrome,Safari和Opera中使用。 Thanks folks! 谢谢大家!

The only event associated with CSS3 transitions is the transitionend [1]. 与CSS3过渡相关的唯一事件是transitionend [1]。

[1] http://www.w3.org/TR/css3-transitions/#transition-events- [1] http://www.w3.org/TR/css3-transitions/#transition-events-

There are no other CSS transition events: http://dev.w3.org/csswg/css3-transitions/#transition-events- 没有其他CSS过渡事件: http//dev.w3.org/csswg/css3-transitions/#transition-events-

I am assuming you are adding a css class that handles the transition either on page load or on some type of event (mouseover, click, mouseenter etc). 我假设您正在添加一个CSS类,该类在页面加载或某种类型的事件(鼠标悬停,单击,mouseenter等)上处理过渡。 Use that as your start for your parallel javascript function. 使用它作为并行javascript函数的开始。 Then use transitionEnd to stop it. 然后使用transitionEnd来阻止它。 To get it compatible with multiple browsers you might want to read 要使其与您可能想要阅读的多个浏览器兼容

https://developer.mozilla.org/en/CSS/CSS_transitions https://developer.mozilla.org/en/CSS/CSS_transitions

Hope that helps 希望有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM