take in account the visibility of realHeader and stickyHeader