I'm looking to implement a floating navbar on my website, the kind that scrolls down with you and stays at the top of the window.
However, I've run into an issue with certain Android versions (like 4.3) when using the fixed position. My navbar won't stretch to 100% width and instead leaves a small space on the left (almost like a 95% width that floats right).
This is the CSS for my navbar:
#navBar
{
position: fixed;
top: 0px;
width: 100%;
height: 75px;
background-color: #ffffff;
box-shadow: 0px 0px 6px #666666;
z-index: 1;
}
Additionally, I've included this in my HTML file:
<meta name="viewport" content="width=100%; initial-scale=1; maximum-scale=1; minimum-scale=1; user-scalable=no;" />
I've also attempted to adjust the width using JavaScript:
var documentWidth = $(window).innerWidth();
$('#navBar').width(documentWidth);
Is there a way to address this issue using JavaScript without relying on position fixed? Or do you have any other suggestions?