子菜单隐藏在谷歌地图背后

时间:2014-08-04 10:26:19

标签: javascript php html css google-maps

当你走过时home page(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'});
    });

    });

3 个答案:

答案 0 :(得分:1)

检查控制台,你没有在kontakt页面中包含jquery。

将此插入您的kontakt.php

<script src="js/vendor/jquery-1.10.1.min.js"></script>

答案 1 :(得分:0)

未捕获的ReferenceError:$未定义检查时收到此消息

kontakt.php

中缺少jQuery文件

答案 2 :(得分:-1)

为地图和菜单容器分配“z-index”css属性,菜单的一个必须大于map的一个,例如100为菜单,99为地图。

相关问题