Fix issue with javascript and sidebar animation