Skip to content
Advertisement

Responsive nav bar not sticking on some screens

I am having a problem with the taskbar on my webpage. It is “sticky” on scroll down on a laptop screen, even when I resize the window to a size where the nav menu goes into a toggle.

However when I use the inspector to view it on IPhone or any screen type using the chrome inspector the “sticky” nav doesn’t work until I scroll halfway down the page and then back up.

I would also appreciate any corrections to help me improve my work so far, I am a total beginner.

JavaScript
JavaScript
JavaScript

Advertisement

Answer

It’s actually because of your logo. When the screen reduces, you’re not doing anything with it in your media query so it sticks to the top of the header as you’ve written it. If you add the logo class to your media query and style it appropriately, you can prevent it from breaking the sticky nav. See snippet, make sure you view it on a mobile device too.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement