调整窗口大小时,导航项目消失

时间:2017-11-04 19:21:53

标签: jquery html css bootstrap-4

我在bootstrap中使用了折叠功能,但每当我调整窗口大小时,我的nav元素就会消失。你们有什么建议吗?我的代码如下:                            Navbar |田径队          

    <nav class= "navbar navbar-expand-lg">
        <a class="navbar navbar-brand" href="#"> Athletics 
            <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQHBhQIBxAVFRUXFxgbGRgXGB0WGBoXIxogHxodHSAaICgiHh4lIB0XITEhJSkrLi4uGh8zODMsNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAMAAvgMBIgACEQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAABwgEBQYDAgH/xABJEAABAwICBAUQCAUDBQAAAAABAAIDBAUGEQcSITFBUWFxkQgTFBYiMkJSVXKBk6GxstEjNDU2YnOiwRVDdIKSJMLwMzdUY9L/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AifFF+nvl8kr6+RxcXnLacmjPYG8QCyrzjasvNlhtVbO8siBHfHN+3Zr8eqNg5Foaz62/zne9eKCVdAeIJoMVizGRxhlY86hOYD2jMEcW4hWOVW9Bn/ceDzZfgKtIgIiw7rcY7TbpLhXO1Y42lzjyD90GYigir0+vFw/0dCzrOfhPPXCPRsHQcuVS5hHEkWK7Gy627PVOYc098x43tPsOfCCCg3aIiAiIgIiICIiAi4HSTpJjwWW0kTOu1DxrBmeTWt25OceXI7P+HQYF0ztvl2bbL3A2EyHJj2ElutwNcDtGfGgl1ERB8TP63EX8QJ6FTbEGIJ79eH3OulcXOcSNp7kcAbxAbtiuPVfVX+afcqQoOlvmNau+WeG1187iyIEbzm/bsL+MgbF0+hzFk9quEtCx5dEYy7UccwHBzRmM92wkFRmut0a/br/yXfGxBzFZ9bf5zvevFe1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UGFbQ23WxuQHfOPfPdwud8uBbtB8MYI2BjAABuA3L7REBYdytsV0pjTXGFkjD4L2hw9qzEQQljrQk10bq3CJyO8wPOw+Y47uZ3TwKD6qmfSVDqaqYWPacnNcMiCOAhXdUbaXNHbcUUBudsZlVxjZl/NaPAP4vFPo4sgrKvWCZ1PMJoHFrmkEEbCCNxC+HNLHarhkRxr5QWx0X4wGL8NNnmI69HkyUDxstjuZ2/nzXZKrWhfEZsGNI4pHZRVH0T+LM9470OyHMSrSoCIiAiIgIiICIiCK+qGupo8IR0DDkZ5Rn5jBrH26irgpj6pKqLr7SUZOxsLn5crn5f7AocQFYrqfcNi34edfJx9JUHJvJE0/7nZn0NVd2t13hreHYrm4YoRbMO09CwZakTBly6oz9uaDaIiICIiAiIgIiIKxaccNCxYvNXTDKOpBkGW4PzykHTk7+5RyrG9UTbxUYRiruGKYD0OBB9oaq5IPuKQwyCSM5EEEc4VzMM3IXfD1PcR/MiY485G325qmCtNoQrOy9HNO074zIzoeSPY4BB3qIiAiIgIiICIiCuHVE/fSPP/wAdvxOUVqzOmXAT8WUDK+1AGohBGqTl1yM7S0coO0ceZHEq51dqno6g09XBIx43tcxwPuQeVA3Xro2jbm9o9oV2gMhkFXfRHo2nrbxHer3E6KGJwe1rxk6Rw73YfBB258O5WJQEREBERAREQEREHBacIjJo5nIGeq6M83dgfuqsq6d+tTL5Z5bXWDuJWFp4xxEcoOR9Cqpi7A1XhauMNbC5zM+5lYCWOHBtG48h2oOXVl+p8+4J/Pk9zVA+G8IVeI6wU1tgedu15BaxvK5x2ehWqwhYGYZw9Daac56jdrvGcTm4+kkoN0iIgIiIP//Z" width="30" height="25">
        </a>

        <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
            <div class="navbar-nav">

                <a class="nav-item nav-link" href="#"> Shop </a>
                <a class="nav-item nav-link" href="#"> About Us </a>
                <a class="nav-item nav-link" href="#"> Lookbook </a>

            </div>


        </div>

    </nav>


</body>

2 个答案:

答案 0 :(得分:1)

您使用的是bootstrap样式。在引导程序导航中,当您调整窗口大小时,菜单将缩小并显示在汉堡图标下。如果你不想汉堡图标添加到“in”类

下面
<div class="collapse navbar-collapse in" id="navbarNavAltMarkup">

如果您想要默认行为汉堡图标,请在行上方添加以下代码

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
    </button><div class="collapse navbar-collapse" id="navbarNavAltMarkup">

<nav class= "navbar navbar-expand-lg">
        <a class="navbar navbar-brand" href="#"> Athletics 
            <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQHBhQIBxAVFRUXFxgbGRgXGB0WGBoXIxogHxodHSAaICgiHh4lIB0XITEhJSkrLi4uGh8zODMsNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAMAAvgMBIgACEQEDEQH/xAAcAAEAAgMBAQEAAAAAAAAAAAAABwgEBQYDAgH/xABJEAABAwICBAUQCAUDBQAAAAABAAIDBAUGEQcSITFBUWFxkQgTFBYiMkJSVXKBk6GxstEjNDU2YnOiwRVDdIKSJMLwMzdUY9L/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AifFF+nvl8kr6+RxcXnLacmjPYG8QCyrzjasvNlhtVbO8siBHfHN+3Zr8eqNg5Foaz62/zne9eKCVdAeIJoMVizGRxhlY86hOYD2jMEcW4hWOVW9Bn/ceDzZfgKtIgIiw7rcY7TbpLhXO1Y42lzjyD90GYigir0+vFw/0dCzrOfhPPXCPRsHQcuVS5hHEkWK7Gy627PVOYc098x43tPsOfCCCg3aIiAiIgIiICIiAi4HSTpJjwWW0kTOu1DxrBmeTWt25OceXI7P+HQYF0ztvl2bbL3A2EyHJj2ElutwNcDtGfGgl1ERB8TP63EX8QJ6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dKjvYmF3ORuHpOQVOLnXPudwkr6s5vkcXOPKTmgxURbjC9hlxNe47VQDunnaTua0d848wQfeFsMVGKLiKK0xlx3ucdjWDjceD91YLBmiKjsDGz3JoqZ9h1nj6Np/Czd6XZ+hdXhPDUGFbQ23WxuQHfOPfPdwud8uBbtB8MYI2BjAABuA3L7REBYdytsV0pjTXGFkjD4L2hw9qzEQQljrQk10bq3CJyO8wPOw+Y47uZ3TwKD6qmfSVDqaqYWPacnNcMiCOAhXdUbaXNHbcUUBudsZlVxjZl/NaPAP4vFPo4sgrKvWCZ1PMJoHFrmkEEbCCNxC+HNLHarhkRxr5QWx0X4wGL8NNnmI69HkyUDxstjuZ2/nzXZKrWhfEZsGNI4pHZRVH0T+LM9470OyHMSrSoCIiAiIgIiICIiCK+qGupo8IR0DDkZ5Rn5jBrH26irgpj6pKqLr7SUZOxsLn5crn5f7AocQFYrqfcNi34edfJx9JUHJvJE0/7nZn0NVd2t13hreHYrm4YoRbMO09CwZakTBly6oz9uaDaIiICIiAiIgIiIKxaccNCxYvNXTDKOpBkGW4PzykHTk7+5RyrG9UTbxUYRiruGKYD0OBB9oaq5IPuKQwyCSM5EEEc4VzMM3IXfD1PcR/MiY485G325qmCtNoQrOy9HNO074zIzoeSPY4BB3qIiAiIgIiICIiCuHVE/fSPP/wAdvxOUVqzOmXAT8WUDK+1AGohBGqTl1yM7S0coO0ceZHEq51dqno6g09XBIx43tcxwPuQeVA3Xro2jbm9o9oV2gMhkFXfRHo2nrbxHer3E6KGJwe1rxk6Rw73YfBB258O5WJQEREBERAREQEREHBacIjJo5nIGeq6M83dgfuqsq6d+tTL5Z5bXWDuJWFp4xxEcoOR9Cqpi7A1XhauMNbC5zM+5lYCWOHBtG48h2oOXVl+p8+4J/Pk9zVA+G8IVeI6wU1tgedu15BaxvK5x2ehWqwhYGYZw9Daac56jdrvGcTm4+kkoN0iIgIiIP//Z" width="30" height="25">
        </a>
		<!-- toggle navigation
		<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
		</button>-->
        <div class="collapse navbar-collapse in" id="navbarNavAltMarkup">
            <div class="navbar-nav">

                <a class="nav-item nav-link" href="#"> Shop </a>
                <a class="nav-item nav-link" href="#"> About Us </a>
                <a class="nav-item nav-link" href="#"> Lookbook </a>

            </div>


        </div>

    </nav>

答案 1 :(得分:0)

这是bootstrap的正确行为。

在较小的屏幕上观看时,它意味着重新组织更大的元素。

您需要做的是包含navbar-toggle元素,并使用data-target="#navbarNavAltMarkup"将其链接到导航菜单。此外,您的菜单中的a标记必须位于li标记内,而这些标记本身需要位于ul标记内。

此结构将满足您的需求:

working jsFiddle

<nav class="navbar navbar-inverse navbar-static-top navbar-expand-lg" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbarNavAltMarkup">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="nav-brand" href="#"> Athletics 
            <img src="" width="30" height="25">
        </a>
    </div> 
    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
      <div class="navbar-nav">
        <ul class="nav navbar-nav">
          <li><a class="nav-item nav-link" href="#"> Shop </a></li>
          <li><a class="nav-item nav-link" href="#"> About Us </a></li>
          <li><a class="nav-item nav-link" href="#"> Lookbook </a></li>
        </ul>
      </div>
    </div> 
  </div>
</nav>

如果您希望禁用此行为,请参阅Bootstrap 3 - disable navbar collapse