Updated previous to handle scrolling fixed elements