在主页(pocetna(上,当你浏览"dizajn"垂直菜单时,效果很好,但当你进入"kontakt"页面时,问题出现了,菜单就在谷歌地图后面,我不知道如何解决它。如果有人知道解决方案,我会很感激。谢谢
javascript的代码是这样的(这段代码是从视频中复制的如何创建垂直菜单,因为我对编码不太了解。谢谢你的理解(
$("document").ready(function() {
// Function triggered when mouse hovers over a menu item
// Looking for a LI item that has a UL for a child element
// If it does trigger the function on mouseover
$('#sidebarmenu li a').parent().has('ul').mouseover(function() {
// offset() returns the top & left relative position on the doc for LI
tagOffset = $(this).offset();
/* I use the following to get the tag name for this
getTagName = $(this).get(0).tagName;
alert(getTagName); */
// Get distance from the left for the LI
offsetLeft = tagOffset.left;
// Get distance from the top for the LI
offsetTop = tagOffset.top;
// Move the new popup 180px to the left (Width of parent UL)
popOutOffsetLeft = offsetLeft + 226;
// Get the id for the first UL contained in the LI
closeParent = $(this).closest("ul").attr("id");
// Checking if the UL is a second level of third level popup menu
if (closeParent == 'sidebarmenu')
{
// Make menu visible and move it into position on the document
$(this).find('ul').first().css({'visibility' : 'visible', 'left' : popOutOffsetLeft + 'px', 'top' : offsetTop + 'px'});
} else {
// Find offset for the UL that surrounds the third level popup
secondOffset = $(this).find('ul').last().parent().offset();
// Subtract the top offset from the second menu to position properly
secondOffsetTop = secondOffset.top - offsetTop;
// Correct the positioning on offset left
secondOffsetLeft = offsetLeft - 10;
// Make menu visible and move it into position on the document
$(this).find('ul').last().css({'visibility' : 'visible', 'left' : secondOffsetLeft + 'px', 'top' : secondOffsetTop + 'px'});
}
});
// When the mouse moves off the menu hide everything
$('#sidebarmenu li a').parent().has('ul').mouseout(function() {
$(this).find('ul').css({'visibility' : 'hidden'});
});
});
查看控制台,您还没有在kontakt页面中包含jquery。
将此插入您的kontakt.php
<script src="js/vendor/jquery-1.10.1.min.js"></script>
未捕获引用错误:未定义$在检查时收到此消息
kontakt.php
中缺少jQuery文件
为映射和菜单容器分配"z-index"css属性,并且菜单的一个必须大于映射的一个,例如100表示菜单,99表示映射。