Fix bug with animation when scrolled