【问题标题】:Navigation bar disappears导航栏消失
【发布时间】:2015-02-17 11:11:05
【问题描述】:

导航栏固定在头部,当点击菜单图标时,整个容器向右滑动

这是我的主页

单击菜单图标时

但是当页面向下滚动并点击菜单图标时,标题消失了

这是我的css代码

.content
{
    position:relative;

    width:100%;
    height:100%;
}
.header
{
  position:fixed;
  width:100%;
  height:50px;
  float: none !important;
clear: both !important;
  background-color:#19b8df;
  left:0;
  top:0;
 z-index: 999999;
}

.menu
{
    float:left;
    margin:10px;
    width:40px;
    height:40px;

}

这是我的html代码

<div class="header">
        <div class="menu"><span><a href="#menu"><img src="images/menu.png" /></a></span>
        </div>

        <div class="searchicon"><a href="search.html"><img src="images/active-search.png" /></a>
        </div>

    </div>

我的 jquery

<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
 <script type="text/javascript" src="js/jquery.mmenu.min.all.js"></script>
 <script>
      $(document).ready(function(){
        $('bav#menu').mmenu();

        });
    </script>

【问题讨论】:

    标签: javascript android jquery html css


    【解决方案1】:

    您创建了 2 个链接,它们都具有指向某个位置的 href 属性。在 HTML 中,如果您单击带有位置的链接,则会加载特定位置并且您当前的链接或页面会丢失。

    您的标题在您当前的页面中,点击后您正在加载另一个页面。

    【讨论】:

    • 另一个链接是一个搜索图标,它会加载一个单独的页面。
    【解决方案2】:
    1. &lt;a href="#menu"&gt;

    上面的行表示您正在链接到同一页面内的元素,其名称属性值为“菜单”示例:

    1. &lt;a href="search.html"&gt;

    上面的行意味着您正在链接到另一个页面本身,因此您会得到空白页面,因为您可能没有 search.html 页面或使用空白 search.html 页面。

    【讨论】:

    • 感谢您的回复,但我的问题不是要获得空白页。搜索图标效果很好。我的问题是,当我向下滚动并单击菜单图标时,标题中的导航栏会消失,否则一切正常。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-19
    • 2013-03-19
    • 1970-01-01
    相关资源
    最近更新 更多