I've implemented a feature where an element moves in relation to scrolling using jQuery:
$('#object').css('transform','translateY('+($(window).scrollTop()*.4)+'px)');
Here's the CSS:
#object {
width:200px;
top:100%;
left:50%;
position:absolute;
}
While this method works, the movement of the element is abrupt without any smooth transition. I tried adding a CSS transition for a delayed effect, but it doesn't look good when scrolling simultaneously:
transition: 400ms ease;
Is there a more elegant solution to achieve smooth movement without compromising the design?