HTML旁边隐藏我的js导航栏

时间:2013-02-03 18:07:53

标签: php javascript html5

我正在自己的个人网站here上工作。如果将鼠标悬停在任何导航栏元素上,您会注意到有一些闪烁,并且并非所有元素都可见。您可以通过F12验证这一点。在我看来,<aside>标签正在“隐藏”我正在寻找的信息。

有人请告诉我如何将导航栏带到前面。我不太确定这里发生了什么。

index.php

<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <title>Grown Kidd Creations</title>
        <link rel="stylesheet" href="css/main.css">
        <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
            });
        </script>
    </head>
    <body>
        <header>
            <img alt="Picture of me and Cian" src="img/caindaddysleepin.jpeg" title="Cian and Daddy">
            <?include_once 'nav/nav.php';?>
        </header>
        <aside class="left"><p>No idea what to put here. how about you fill out the form and tell me?</p></aside>

        <aside class="right">
            Recent News/Updates:<br/>
            <span class="undercon">This will be updated soon with links and maybe a blog.</span>
            <ul>
                <li>Cian</li>
                <li>Work</li>
                <li>Family</li>
            </ul>
        </aside>
        <footer>
            Send me some love at <a href="mailto:billythakidd04@gmail.com">BillyThaKidd04@gmail.com</a><br/>
            Or find me at:<br/>
            <div class="g-plus" data-href="https://plus.google.com/109325835178774768962?prsrc=3" data-theme="dark" rel="author"></div>
            <a href="https://twitter.com/ThaKidd04" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @ThaKidd04</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
        </footer>
    </body>
</html>

nav.php

<?//navigation bar?>
<script>
    var el = document.getElementsByTagName("body")[0];
    el.className = "";
</script>
<noscript>
<!--[if IE]>
    <link rel="stylesheet" href="nav/css/ie.css">
<![endif]-->
</noscript>
<link rel="stylesheet" href="nav/css/nav.css">
    <!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <nav id="topNav" class="no-js">
        <ul>
            <li><a href="index.php" title="Home">Home</a></li>
            <li><a href="#" title="Projects">Projects</a>
                <ul>
                    <li><a href="" title="Personal Projects">Personal Projects</a></li>
                    <li><a href="" title="Work Projects">Work Projects</a></li>
                    <li class="last"><a href="pages/sitepage.php" target="new" title="About this site">This Site</a></li>
                </ul>
            </li>
            <li><a href="contactme.php" title="Contact Me">Contact Me</a>
                <ul>
                    <li><a href="http://www.facebook.com/BillyThaKidd" target="new" title="FaceBook">FaceBook</a></li>
                    <li><a href="" target="new" title="Google Plus">Google +</a></li>
                    <li><a href="" target="new" title="LinkedIn">LinkedIn</a></li>
                    <li class="last"><a href="" title="Email Me">Email Me</a></li>
                </ul>
            </li>
            <li><a href="/pages/viewblog.php" title="About Me">About Me</a>
                <ul>
                    <li><a href="/pages/viewblog.php">Blog</a></li>
                    <li><a href="" title="Resume">Resume</a></li>
                    <li class="last"><a target="new" href="https://github.com/billythakidd04" title="GitHub">GitHub</a></li>
                </ul>
            </li>
        </ul>
    </nav>
    <script src="nav/js/modernizr.custom.69568.js"></script>
    <script>
        (function($)
        {
            //cache nav
            var nav = $("#topNav");

            //add indicators and hovers to submenu parents
            nav.find("li").each(function()
            {
                if ($(this).find("ul").length > 0)
                {
                    $("<span>").text("").appendTo($(this).children(":first"));

                    //show subnav on hover
                    $(this).mouseenter(function()
                    {
                        $(this).find("ul").stop(true, true).slideDown();
                    });

                    //hide submenus on exit
                    $(this).mouseleave(function()
                    {
                        $(this).find("ul").stop(true, true).slideUp();
                    });
                }
            });
        })(jQuery);
    </script>

1 个答案:

答案 0 :(得分:1)

您应该发布css,因为似乎整个问题已经关联 - 或者至少可以通过z-index调整来解决:

  

z-index CSS属性指定元素的z顺序及其顺序   后人。当元素重叠时,z顺序决定哪一个   涵盖了另一个。具有较大z指数的元素通常覆盖一个   较低的元素。