I am working on a small website for an Android App I'm releasing, but I have a small problem that I can't seem to find the answer to.
In Firefox, everything works properly but when you scroll and then click on a nav link (simply using an id to move down the page) but on Chrome, the navigation disappears until you scroll some more.
The website is up at www.ioudebtcalculator.com
These are the only styles I have applied:
#navBar {
background-color:#000;
position:fixed;
width:100%;
font-family:sans-serif;
font-weight:bold;
font-size:13pt;
height:70px;
}
Edit: I have since removed the position fixed from the navBar on the website so you will no longer see the problem there. The problem has not yet been solved.
You can easily add position fixed to the navBar element using Developer Tools or any other equivalent tool to see the problem.
I have no clue what's going wrong. But I'm going to throw out my best guess since nobody's answered yet.
The following looks like a good candidate for screwy behavior:
id
is a property not an attribute, and adding and removing ids seems like a really bad idea because that's how elements in the DOM are uniquely identified. That's something I wouldn't mess around with. Plus it's easy to recreate the desired functionality with classes:Maybe I got lucky?
It might be benefitial to use a scroll:
This will make it more userfriendly because it's gracefull and the problem (I imagine) is in the fact that Chrome doesn't register the position change because of the current method.
Please replace your css using below code
I just added two things both in Chrome and Firefox and it was working well. I clicked the link and scrolled a bit too, the nav stays as its expected.
You should add
top: 0
to your element. That will align it to the top of the page no matter what. You may need to add padding to the top of the content wrapper so that it is never covered by the nav.it works for me when adding this to your navbar css
making it