基本上我试图在元素悬停时和鼠标离开时有不同的过渡时间,
#bar{ position:fixed; bottom:-25px; } /*here you only get to see a piece of the bar */
#bar:hover{ transform: .2s linear; bottom:0; }
还有类似的东西
/*this only represents my made out status to cover what i need*/
#bar:mouseLeaved{ transform: 2s linear }
这样,显示需要 0.2 秒,隐藏需要 2 秒
我可以在不需要 javascript 的情况下做到这一点吗?
最佳答案
我建议这样做:
#bar { transition: 2s linear; }
#bar:hover { transition: .2s linear; }
并且,当 :hover 生效时,让 CSS 的顺序为您处理事情(它将覆盖另一个)。
关于css3 过渡 : different time value when :hover In than Out?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8863583/