Suppose we need a transition for width and position.
However, using a long duration can result in unexpected behavior. The timing function will reset from zero for the remainder of the operation.
#test {
border: solid 1px;
width: 100px;
height: 50px;
transition: width 10s linear;
}
#test:hover {
width: 1000px;
transition: width 10s linear;
}
<div id="test"></div>
If you rehover the div at any point during the transition, it will take 10s
to transition over 500px
, not the original settings. Additionally, it will take 10s for the last 10px.
Is there any workaround for this issue or should I consider using the jQuery animate
function?