Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Background animated on mouseleave problem

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #169823
    maxisix
    Participant

    Hey guys i’am trying to do a background animation on hover. The problem is when the mouse leave the background is coming back to his normal position but its not really smooth. You can try on http://codepen.io/maxisix/pen/Aiprm?editors=110

    thx !

    #169948
    Mottie
    Member

    Try this (demo)

    header {
      background: url(http://subtlepatterns.com/patterns/food.png);
      width: 100%;
      height: 300px;
      animation: animatedBackground 5s linear infinite;
      -webkit-animation-play-state:paused;
      -moz-animation-play-state:paused;
      -o-animation-play-state:paused; 
      animation-play-state:paused;
    
      &:hover {
        -webkit-animation-play-state:running;
        -moz-animation-play-state:running;
        -o-animation-play-state:running; 
        animation-play-state:running;
      }
    
    }
    
    @keyframes animatedBackground {
        from { background-position: 0 0; }
        to { background-position: 100% 0; }
    }
    
    #170006
    maxisix
    Participant

    Oh nice i tried this but it didn’t worked for me… maybe because autoprefixer doesnt support this feature yet ! Thx ! SOLVED ! :)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.