我有一个包含过渡的布局,它们顺利进入该过渡,但一旦光标离开所选区域,就会突然回到第一个位置。
}
#holder div:hover {
width:92px;
background-color:#dddddd;
-webkit-transition:all .4s ease-out;
-moz-transition:all .4s ease-out;
-ms-transition:all .4s ease-out;
-o-transition:all .4s ease-out;
transition:all .4s ease-out;
这就是它的编码,有人能帮助我让它顺利恢复到原始形式吗?谢谢!
此选择器仅在:hover
编辑#holder
子div
时匹配。
#holder div:hover {
background-color: #DDD;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-ms-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
width: 92px;
}
这意味着您的过渡仅在悬停div 时适用。一旦您停止悬停,过渡将不再适用,样式将跳回。
要使其双向工作,您需要将转换声明放在#holder div
:
#holder div {
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-ms-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
}
#holder div:hover {
background-color: #DDD;
width: 92px;
}