css3 transition以及transitionEnd事件学习

本文深入探讨了CSS3过渡效果的基础概念,并通过实际案例展示了如何在内容隐藏与显示时利用过渡效果提升用户体验。文章还介绍了transitionEnd事件的使用方法及特性,包括事件属性解析、jQuery兼容性判断等,最后提供了示例代码和资源链接。

css3 transition

基础内容,参考此链接

http://www.w3cplus.com/content/css3-transition

注意当隐藏和显示内容时,

从height:0到height :auto时,transition不起作用,

可以使用max-height代替;

transitionEnd事件,会多次触发,addEventListener是可以使用e.propertyName判断是否是对应属性;

使用jquey时可以使用e.orginalEvent.propertyName判断是否对应属性已完成

transitionEnd的event的具体属性如下:

PropertyDescription
targetThe event target; in other words, the element that actually fired thistransitionend event.
typeThe type of event, in this case, the string "transitionend".
canBubbleBoolean indicating whether this event bubbles.
cancelableBoolean indicating whether it's possible to cancel this event.
propertyNameThe name of the CSS property being transitioned. In a CSS transition where there are multiple CSS properties being transitioned, transitionend fires oncefor each of these properties, one after another.
elapsedTimeThe amount of time this transition has been running when the event (in this case, transitionend) fires, in seconds.
pseudoElementThe name of the CSS pseudo-element (beginning with two colons, such as ":before", ":after", ":first-letter" etc) on which the transition occurred, or the empty string if the transition occurred on the element itself.

 demo:

http://jsfiddle.net/hewei/JrKA6/

转载于:https://www.cnblogs.com/xmjzblog/p/3878069.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值