2017-05-03 131 views
0

所以我正在为学校编写一个网站。我已经编写了一个包含点击选项的侧面菜单。我还编了一些你点击的东西。我的问题,即使它们存在,它说“filler.html不存在”。当我点击。即使它们存在。所以,这是我的代码。如果您还有其他问题,请提出问题。CSS和JavaScript菜单问题

function openNav() { 
 
    document.getElementById("mySidenav").style.width = "250px"; 
 
} 
 

 
function closeNav() { 
 
    document.getElementById("mySidenav").style.width = "0"; 
 
}
body { 
 
    font-family: "Lato", sans-serif; 
 
} 
 

 
.ABox { 
 
    background-color: black; 
 
    color: lightgrey; 
 
    width: auto; 
 
    padding: 1%; 
 
} 
 

 
.sidenav { 
 
    height: 100%; 
 
    width: 0; 
 
    position: fixed; 
 
    z-index: 1; 
 
    top: 0; 
 
    left: 0; 
 
    background-color: #111; 
 
    overflow-x: hidden; 
 
    transition: 0.5s; 
 
    padding-top: 60px; 
 
} 
 

 
.sidenav a { 
 
    padding: 8px 8px 8px 32px; 
 
    text-decoration: none; 
 
    font-size: 25px; 
 
    color: #818181; 
 
    display: block; 
 
    transition: 0.3s 
 
} 
 

 
.sidenav a:hover, 
 
.offcanvas a:focus { 
 
    color: #f1f1f1; 
 
} 
 

 
.closebtn { 
 
    position: absolute; 
 
    top: 0; 
 
    right: 25px; 
 
    font-size: 36px !important; 
 
    margin-left: 50px; 
 
} 
 

 
@media screen and (max-height: 450px) { 
 
    .sidenav { 
 
    padding-top: 15px; 
 
    } 
 
    .sidenav a { 
 
    font-size: 18px; 
 
    } 
 
}
<div id="mySidenav" class="sidenav"> 
 
    <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a> 
 
    <br> 
 
    <a href="/StoryTime.html">The beginning of logic and rhetoric</a> 
 
    <a href="/rhetoric.html">What is rhetoric?</a> 
 
    <a href="/classics.html">What is classics?</a> 
 
    <a href="/timeline.html" Timeline</a> 
 
</div> 
 

 
<div class="ABox"> 
 
    <h2>Classics and Rhetoric</h2> 
 
</div> 
 
<p style="background-color:black;color:lightgrey;width:200px;padding:1%;"></p> 
 
<span style="font-size:30px;cursor:pointer" onclick="openNav()">☰</span>

回答

3

尝试删除开头的 “/”。这意味着绝对目录,当你想要亲属。

<a href="StoryTime.html">The beginning of logic and rhetoric</a> 
<a href="rhetoric.html">What is rhetoric?</a> 
<a href="classics.html">What is classics?</a> 
<a href="timeline.html">Timeline</a> 
0

替换:

来源:

<a href="/timeline.html" Timeline</a> 

要:

<a href="/timeline.html"> Timeline</a> 
+0

所有这一切都来自我的SideNav删除它们,然后我试着“/“ 上 在引文的外面,这给了我同样的问题。 –

+0

没关系。感谢您所有的帮助。我不知道我做了什么,但我认为这可能是文件的问题。再次感谢! –