Moving top header hiding operation from CSS to JS