how to trigger css transition before hover

*爱你&永不变心* 提交于 2020-01-07 09:23:34

问题


So, I made sidebar hidden and shows up when on mouse hover. My question is how to trigger the css transition before the mouse hover on the sidebar, just like in this sidebar link: https://la24.org/vision . how I do that? many thanks


回答1:


There are two ways doing it.

  1. Javascript - Just toggle expanded class whenever needed.
  2. Pure CSS - Sideabar Wrapper and Sidebar element

In this case you can trigger your .sidebar animation on .sidebar-wrapper hover:

.sidebar-wrapper:hover > .sidebar{
   **Your hover state** (e.g. width: 300px)
}


来源:https://stackoverflow.com/questions/42130500/how-to-trigger-css-transition-before-hover

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!