我在创建一个导航栏时遇到了一些困难,点击它会在同一页面上打开一个小窗口,就像在 the image 上一样。 .
最佳答案
创建小窗口作为它自己的 div:
<div id="myID"> This content will show when I click the navbar</div>
添加以下 CSS:
#myID{
display: none;
}
然后使用一些脚本来显示/隐藏元素:
$(document).ready(function(){
// change #nav to whatever the ID of the nav element is.
$('#nav').on('click', function(){
// show/hide pop up on click
$('#myID').toggle();
});
});
关于javascript - 如何创建一个导航栏,单击它会在同一页面上打开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51850523/