To Fix the Header to top Follow these Steps
1.Create a Div in Html as shown in the below code
2. then add CSS, to it Position:fixed is very important to fix the header.
3. Then add JS
you can also use this too. If the trigger point is unknown but should be whenever the sticky element reaches the top of the screen,
offset().top can be used. then you can use the JS.