简体   繁体   English

如何在标准页面上设置侧边导航菜单 HTML 元素

[英]How to Set Up Side Navigation Menu HTML Element on Standard Page

I am having trouble getting my HTML custom embed sidebar navigation menu to close on my Weebly page.我无法让我的 HTML 自定义嵌入侧边栏导航菜单在我的 Weebly 页面上关闭。 I built it in Dreamweaver and it is working perfectly fine when viewing on their or view the HTML element itself.我在 Dreamweaver 中构建了它,并且在查看它们或查看 HTML 元素本身时它工作得非常好。 Even on the Weebly standard page, I can click on the icon to open the menu and it fleshes out perfectly.即使在 Weebly 标准页面上,我也可以单击图标打开菜单,它会完美地充实。 However, I can't close the menu (unless I refresh the page).但是,我无法关闭菜单(除非我刷新页面)。

Any help or advice on how to make this possible would be great!关于如何使这成为可能的任何帮助或建议都会很棒! I want to be able to add this element smoothly to each of my standard pages.我希望能够顺利地将这个元素添加到我的每个标准页面中。

I am very new to code and understand that this probably should have been built before adding content to the pages but it would be awesome if I could just get the last function "closeNav" to work!我对编码非常陌生,并且明白这可能应该在向页面添加内容之前构建,但如果我能让最后一个函数“closeNav”工作,那就太棒了!

URL: https://tnucii.weebly.com/new-page.html网址: https : //tnucii.weebly.com/new-page.html

Code:代码:

 <html> <head> <meta charset="UTF-8"> <title>Blackboard Communication Tools for Students</title> </head> <style> body { font-family: "Raleyway", sans-serif; transition: background-color .5s; } .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 { color: #f1f1f1; } .sidenav .closebtn { position: absolute; top: 0; right: 25px; font-size: 36px; margin-left: 50px; } #main { transition: margin-left .5s; padding: 16px; } @media screen and (max-height: 450px) { .sidenav {padding-top: 15px;} .sidenav a {font-size: 18px;} } .sidenavmenu { color: #252525; } .sidenavmenu:hover { opacity: .5; } </style> <body> <div id="mySidenav" class="sidenav"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a> <a></a> <a href="#">Our Team</a> <a href="#">Blackboard Learn Resources</a> <ul> <li> <a href="#">Faculty Resources</a></li> <ul> <li> <a href="#">Getting Started</a></li> <li> <a href="#">Coruse Content Management</a></li> <li> <a href="#">Grades and Feedback</a></li> <li> <a href="#">Communicaiton</a></li> </ul> <li> <a href="#">Student Resources</a></li> <ul> <li> <a href="#">Getting Started</a></li> <li> <a href="#">Communicaiton</a></li> <li> <a href="#">Coruse Content</a></li> <li> <a href="#">Grades and Feedback</a></li> </ul> </ul> <a href="#">Accessibility Resources</a> <ul> <li> <a href="#">Faculty Resources</a></li> <ul> <li> <a href="#">Blacbkoard Ally</a></li> <li> <a href="#">Accessible Design</a></li> <li> <a href="#">Captioning</a></li> <li> <a href="#">Accessbile Live Sessions</a></li> </ul> <li> <a href="#">Student Resources</a></li> <ul> <li><a href="#">Blacbkoard Ally</a></li> <li><a href="#">Captioning</a></li> </ul> </ul> <a href="#">Clients</a> <a href="#">Contact</a> </div> <span class="sidenavmenu" style="font-size:13px;cursor:pointer" onclick="openNav()">&#9776; Knowledge Base Navigation </span> <p></p> <script> function openNav() { document.getElementById("mySidenav").style.width = "350px"; document.getElementById("main").style.marginLeft = "350px"; document.body.style.backgroundColor = "rgba(0,0,0,0.4)"; } function closeNav() { document.getElementById("mySidenav").style.width = "0"; document.getElementById("main").style.marginLeft= "0"; document.body.style.backgroundColor = "white"; } </script> </body> </html>

在此处输入图片说明

Change it to 1 ;-)将其更改为 1 ;-)

Your navigation is above your sidebar.您的导航位于侧边栏上方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM