Nav fixes at certain point on the page scroll

Hi Folks,
Has anyone any idea how I can make a navigation that’s positioned halfway down a page, to fix to the top of the page once you scroll up to it? Basically like they’ve done this on this website:
They appear to be using a class that changes the site header to fix when it hits a certain point on scroll. How is this achieved?