猿问

HTML 导航栏向下推动页面内容

在我制作的网页上,整个页面内容将被导航栏向下推。我使用了 fullpage.js,但导航栏会下推整个页面内容,包括文本和图像。我该如何解决这个问题?图像的问题可以显示在第三张幻灯片上。

<!DOCTYPE html>

<html>


<head>

  <title>title</title>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/3.0.8/fullpage.min.css" integrity="sha256-+dIh4jG2jQTHZwW81yUo8h6tzXWcNumyNL5XPZbwp1E=" crossorigin="anonymous" />

  <link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">

  <link rel="stylesheet" href="css/stylesheet.css">

</head>


<body>

  <div id="myNav" class="overlay">

    <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>

    <div class="overlay-content">

     <a href="index.html">Home</a>

      <a href="junior.html">submenu1</a>

      <a href="senior.html">submenu2</a>

      <a href="contact.html">submenu3</a>

    </div>

  </div>


  <span class="stickynav" onclick="openNav()">&#9776;</span>

  <img style="float: right;" src="images/dummy.png" alt="dummy" class="stickynav" width="100" height="120" class="dummy">


  <script>

    function openNav() {

      document.getElementById("myNav").style.height = "100%";

    }


    function closeNav() {

      document.getElementById("myNav").style.height = "0%";

    }

  </script>


  <div id="fullPage">

    <div class="section s1" id="section1" class="fontsize">

      <h1 style="color:white;font-size:80px;z-index:999!important;"><strong>title</strong></h1>

    </div>





MYYA
浏览 160回答 1
1回答

拉丁的传说

<!DOCTYPE html><html><head>&nbsp; <title>title</title>&nbsp; <meta charset="utf-8">&nbsp; <meta name="viewport" content="width=device-width, initial-scale=1">&nbsp; <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">&nbsp; <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/3.0.8/fullpage.min.css" integrity="sha256-+dIh4jG2jQTHZwW81yUo8h6tzXWcNumyNL5XPZbwp1E=" crossorigin="anonymous" />&nbsp; <link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">&nbsp; <link rel="stylesheet" href="css/stylesheet.css"></head><body>&nbsp; <div id="myNav" class="overlay">&nbsp; &nbsp; <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>&nbsp; &nbsp; <div class="overlay-content">&nbsp; &nbsp; &nbsp; <a href="index.html">Home</a>&nbsp; &nbsp; &nbsp; <a href="junior.html">submenu1</a>&nbsp; &nbsp; &nbsp; <a href="senior.html">submenu2</a>&nbsp; &nbsp; &nbsp; <a href="contact.html">submenu3</a>&nbsp; &nbsp; </div>&nbsp; </div>&nbsp; <span class="stickynav" onclick="openNav()">&#9776;</span>&nbsp; <img style="float: right;" src="images/dummy.png" alt="dummy" class="stickynav" width="100" height="120" class="dummy">&nbsp; <script>&nbsp; &nbsp; function openNav() {&nbsp; &nbsp; &nbsp; document.getElementById("myNav").style.height = "100%";&nbsp; &nbsp; }&nbsp; &nbsp; function closeNav() {&nbsp; &nbsp; &nbsp; document.getElementById("myNav").style.height = "0%";&nbsp; &nbsp; }&nbsp; </script>&nbsp; <div id="fullPage">&nbsp; &nbsp; <div class="section s1" id="section1" class="fontsize">&nbsp; &nbsp; &nbsp; <h1 style="color:white;font-size:80px;z-index:999!important;"><strong>title</strong></h1>&nbsp; &nbsp; </div>&nbsp; &nbsp; <div class="section s2" id="section2">&nbsp; &nbsp; &nbsp; <h1><strong>title</strong></h1>&nbsp; &nbsp; &nbsp; <p class="container">&nbsp; &nbsp; &nbsp; &nbsp; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel libero eget quam dignissim blandit. Pellentesque ultrices tortor id nulla cursus, vel imperdiet lorem hendrerit. Phasellus pharetra lacus id molestie dictum. In odio sem, porttitor&nbsp; &nbsp; &nbsp; &nbsp; vitae convallis hendrerit, ullamcorper quis enim. Donec aliquet lobortis egestas. Vivamus placerat imperdiet mattis. Quisque tincidunt facilisis diam. Nunc sodales cursus mi id condimentum. Ut blandit mattis velit. Aenean in posuere orci.</p>&nbsp; &nbsp; </div>&nbsp; &nbsp; <div class="section s3" id="section3">&nbsp; &nbsp; &nbsp; <div class="row" id="jema">&nbsp; &nbsp; &nbsp; &nbsp; <div class="col-xs-12 col-md-6">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img src="images/dummy.png" alt="dummy" class="responsive" width="999" height="600">&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; <div class="col-md-6">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <h1> Lorem ipsum</h1>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <p class="container">"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; <div class="row" id="jama">&nbsp; &nbsp; &nbsp; &nbsp; <div class="col-xs-12 col-md-6">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img src="images/dummy.jpg" alt="dummy" class="responsive" width="333" height="200">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img src="images/dummy.jpg" alt="dummy" class="responsive" width="333" height="200">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img src="images/dummy.jpg" alt="dummy" class="responsive" width="333" height="200">&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; </div>&nbsp; &nbsp; <div class="section s4" id="section4">&nbsp; &nbsp; &nbsp; <footer>&nbsp; &nbsp; &nbsp; &nbsp; <h1>title</h1>&nbsp; &nbsp; &nbsp; &nbsp; <h1>Contact information: ---</h1>&nbsp; &nbsp; &nbsp; </footer>&nbsp; &nbsp; </div>&nbsp; </div>&nbsp; <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>&nbsp; <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>&nbsp; <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>&nbsp; <script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/3.0.8/fullpage.min.js" integrity="sha256-caNcSA0LvOCX90PTuEbwl+V09xPMca13CJUasl+VCtk=" crossorigin="anonymous"></script>&nbsp; <script>&nbsp; &nbsp; new fullpage('#fullPage', {&nbsp; &nbsp; &nbsp; autoScrolling: true,&nbsp; &nbsp; &nbsp; navigation: true&nbsp; &nbsp; })&nbsp; </script></body></html>
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答