css - CSS3 Transition Fill Mode -
is there way / trick have transition keeping state animation-fill-mode?
<style> #firstdiv { width: 100px; height: 100px; background: red; animation: firstdivframe 2s; animation-play-state: paused; animation-fill-mode: forwards; } #firstdiv:hover { animation-play-state: running } @keyframes firstdivframe { { background: red; } { background: yellow; } } #seconddiv { width: 100px; height: 100px; background: red; transition: background 2s; } #seconddiv:hover { background: yellow; } </style> <div id="firstdiv"></div> <br /> <div id="seconddiv"></div>
based on above code, want seconddiv behave firstdiv without using javascript code. firstdiv keep state when mouse stops hovering or animation ends, while seconddiv go original state.
no not possible use transitions this. css transitions transition between styles (hence name). if want keep state have added class, need javascript.
Comments
Post a Comment