gpt4 book ai didi

javascript - CSS 和 JavaScript 菜单问题

转载 作者:太空宇宙 更新时间:2023-11-03 22:41:34 24 4
gpt4 key购买 nike

所以我正在为学校编写一个网站。我编写了一个侧面菜单,其中包含您可以单击的选项。我还对您点击的一些内容进行了编码。我的问题是,即使它们存在,它也会说“filler.html 不存在”。当我点击时。尽管它们存在。所以,这是我的代码。如果您有任何其他问题,请提出。

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>

最佳答案

尝试删除前导“/”。当您需要相对目录时,这意味着绝对目录。

<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>

关于javascript - CSS 和 JavaScript 菜单问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43764763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com