add a function to re-calculate header position