【发布时间】:2022-02-10 10:07:03
【问题描述】:
我的商业网站https://www.housewashingdelmarva.com/ 几乎完成了。但是,当在我的手机上查看并单击汉堡包下拉菜单时,菜单会出现在我的标题上方。我希望它像我建立的另一个网站https://oceancitymdlawncare.com/ 一样单击时将标题向下推。我犯了什么错误?
我使用 W3.CSS 作为我的框架。
谢谢
<!--Navigation Buttons-->
<div class="w3-top w3-center w3-theme-d5">
<div class="w3-bar w3-theme-d3 w3-round-xxlarge">
<a class="w3-bar-item w3-button w3-hover-cyan" href="https://www.housewashingdelmarva.com/"><i class="fa fa-home"></i></a>
<a class="w3-bar-item w3-button w3-hover-cyan w3-hide-small" href="#Services">Power Washing Services</a>
<a class="w3-bar-item w3-button w3-hover-cyan w3-hide-small" href="#Testimonials">Testimonials</a>
<a class="w3-bar-item w3-button w3-hover-cyan w3-hide-small" href="#Gallery">Gallery</a>
<a class="w3-bar-item w3-button w3-hover-cyan w3-hide-small" href="#FAQ">FAQ</a>
<a class="w3-bar-item w3-button w3-hover-cyan w3-hide-small" href="#About-Us">About Us</a>
<a class="w3-bar-item w3-button w3-hover-cyan w3-hide-small" href="#Contact-Us">Contact Us</a>
<a href="javascript:void(0)" class="w3-bar-item w3-button w3-right w3-hide-large w3-hover-cyan w3-hide-medium" onclick="myFunction('demo')">☰</a>
</div>
<!-- Navbar on small screens (remove the onclick attribute if you want the navbar to always show on top of the content when clicking on the links) -->
<div id="demo" class="w3-bar-block w3-clear w3-theme-d3 w3-hide w3-hide-medium w3-hide-large">
<a class="w3-bar-item w3-button w3-hover-cyan" href="https://www.housewashingdelmarva.com/" onclick="myFunction()"><i class="fa fa-home"></i></a>
<a class="w3-bar-item w3-button w3-hover-cyan" href="#Services">Power Washing Services</a>
<a class="w3-bar-item w3-button w3-hover-cyan" href="#Testimonials">Testimonials</a>
<a class="w3-bar-item w3-button w3-hover-cyan" href="#Gallery">Gallery</a>
<a class="w3-bar-item w3-button w3-hover-cyan" href="#FAQ">FAQ</a>
<a class="w3-bar-item w3-button w3-hover-cyan" href="#About-Us">About Us</a>
<a class="w3-bar-item w3-button w3-hover-cyan" href="#Contact-Us">Contact Us</a>
</div>
</div>
<script>
function myFunction() {
var x = document.getElementById("demo");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}
</script>
【问题讨论】:
-
请贴一些代码
标签: javascript html css w3.css