滚动并单击后,导航在 Chrome 中消失

2022-01-10 00:00:00 google-chrome navigation html css

我正在为我正在发布的 Android 应用程序开发一个小型网站,但我有一个小问题,我似乎无法找到答案.

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.

在 Firefox 中,一切正常,但是当您滚动然后单击导航链接(只需使用 id 向下移动页面)但在 Chrome 上,导航会消失,直到您再滚动一些.

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.

网站上线了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;
}

我已经从网站上的导航栏中删除了固定位置,因此您将不再看到那里的问题.问题还没有解决.

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.

推荐答案

将它添加到导航栏 css 时对我有用

it works for me when adding this to your navbar css

-webkit-transform: translateZ(0);

制作

#navBar {
    background-color: #000;
    width: 100%;
    position: fixed;
    font-family: sans-serif;
    font-weight: bold;
    font-size: 14pt;
    height: 70px;
    -webkit-transform: translateZ(0);
    z-index: 1;
    box-shadow: 0 2.5px 20px #000;
}

相关文章