Assume we want a transition for width/position
When using a long duration, an undesired behavior comes across, as the timing function will start from zero for the rest 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>
When rehovering the div in any place during the transition say in the middle it will do the transition over 10s
but for 500px
not the original setups, even worse it will take 10s for the last 10px.
Any work around or I should use jQuery animate
function?
Here's a solution, if you don't mind scripting the animation. Essentially, you have to know the time left to cover the remaining width.
Of course, you can make this function to be used on any element, also you can pass in the desired width, but that's outside of this scope.