在浏览器调整大小时触发 CSS3 转换
我一直在玩动画 CSS3 媒体查询,是的,我知道它们的实际用途值得怀疑,但它很有趣。无论如何,我可以将 box/divs/selectors 获取到 transition/expand/contract 等浏览器调整大小,但我在转换时遇到问题。我想做的是以特定分辨率翻转或旋转 div。
可以将其视为 iPad 从横向变为纵向以及发生这种情况时 div 翻转。
这实际上可能吗?如果是的话,我错过了什么/做错了什么?
I have been playing with animated CSS3 Media Queries, yes I know their practical use is questionable but it is fun. Anyways, I can get boxes/divs/selectors to transition/expand/contract etc on browser resize but I am having problems with transforms. What I am trying to do is make a div flip or rotate at certain resolutions.
Think of it as an iPad changing from landscape to portrait and a div flipping when this happens.
Is this actually possible and if so what am I missing/doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,我现在可以使用了。基于后伊拉斯谟的 CSS,我能够对其进行调整并使其 100% 工作。代码如下:
当然,您需要添加其他供应商特定的前缀。当您为属性设置动画时,您需要指定开始和结束状态。因此,忽略变换似乎会将属性重置为 0。
Ok, I have it working now. Based on post-erasmus' css I was able to tweak it and get it working 100%. Here's the code:
Of course, you need to add the other vendor specific prefixes. When you animate a property, you need to specify both the beginning and ending state. So it seems that leaving out the transform will reset the property to 0.
您是否尝试过使用媒体查询?
通过对 ie、firefox 等进行适当的(附加)转换,它似乎可以工作。
我在这里组装了一个jsfiddle。
Have you tried using media queries?
With the appropriate (additional) transforms for ie, firefox, etc. It appears to work.
I put together a jsfiddle here.