javascript - 子菜单隐藏在谷歌地图后面

标签 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'});
    });

    });

最佳答案

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

将此插入您的 kontakt.php

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

关于javascript - 子菜单隐藏在谷歌地图后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25116601/

相关文章:

php - 如何查看我的登录页面中的cookie值?

html - 背景图像宽度和高度适合所有媒体 - 无法使其工作

javascript - 比较条件对

javascript - PHP 中的 HTTPPost 到 JSON

php - Magento 中的 PayPal 集成

html - Angular5 从可观察到组件获取数据

html - 菜单字体大小不一样

javascript - AngularJS 验证表单数组长度

javascript - 使用 Jest 和 React 测试库测试 `img.onLoad`/`img.onError`

php - 当我通过 API 从 Laravel 中的数据库获取用户数据时出现错误