Add CSS transition to top function