r H_height = $("header").height(); var this_scrollTop = $(this).scrollTop(); if (this_scrollTop > P_heightt.top - H_height) { $("header").hide() } else { $("header").show() } }) });