第一次来这里的程序员。我在尝试添加到我正在构建的网站中时遇到了一些 jQuery 问题。我找不到我的代码的问题,但是当我单击相关链接时,它唯一要做的就是在 URL 的末尾添加一个 # 。我在这里想念什么?
谢谢。代码如下。
JavaScript:
$(document).ready(function(){
$('.ShowHideButton').click(function(){
$('.MenuBar').slideToggle('slow');
});
});
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="NavMenu.js"></script>
<link type="text/css" rel="stylesheet" href="common.css">
<title>Test Room, North Wall</title>
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="shortcut icon" href="Icons/Favicon.PNG" type="image/x-icon" />
</head>
<div class="Wall">
<img src="Rooms/NorthBlank.JPG" width = 100% />
</div>
<div class="Tray">
<div class="SlideBar">
<div class="ShowHideButton">
<a href = "#"><img src="Icons/Toggle.png" /></a>
</div>
</div>
<div class="MenuBar">
<ul>
<li><a href = "TestWest.htm"><img src="Icons/NavLeft.png" /></a></li>
<li><img src="Icons/Info.PNG" /></li>
<li><a href = "TestDoor.htm"><img src="Icons/Door.PNG" /></a></li>
<li><a href = "TestEast.htm"><img src="Icons/NavRight.png" /></a></li>
</ul>
</div>
</div>
</body>
</html>
CSS:
head{
font-family: Tahoma;
}
body {
font-family: Tahoma;
background-color: Black;
margin: 0px;
padding: 0px;
}
li {
display: inline;
}
.Wall {
margin: 0px;
padding: 0px;
border: none;
position: fixed;
top: 0px;
left: 0px;
}
.Tray {
width: 100%;
height: 150 px;
position: fixed;
bottom: 0px;
}
.MenuBar {
height: 150px;
width: 600px;
bottom: 0px;
margin-bottom: 0px;
margin-left: auto;
margin-right: auto;
background-color: #999999;
opacity: 0.6;
}
.SlideBar {
width: 100%;
height: 150 px;
position: relative;
bottom: 0px;
}
.ShowHideButton {
height: 16px;
width: 90px;
margin-left: auto;
margin-right: auto;
background-color: #999999;
opacity: 0.6;
}