📜  为样式化的 div 编写悬停动画 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:12.208000             🧑  作者: Mango

代码示例1
import styled, { css } from 'styled-components'

const AnimationContainer = styled.div`
  transform: translate(0%);
  transition: 0.3s ease-out;

  ${props => props.animated && css`
    &:hover {
      position: fixed;
      transform: translate(0%, -30%);
      transition: 0.3s ease-out;
    }
  `}
`

export default AnimationContainer