Reworked fixed header js function