doudeng1870 2015-07-21 12:48
浏览 41
已采纳

当PHP包含[关闭]时,下拉菜单工作HTML问题

The issue is that when the dropdown menu is clicked, no menu comes down. Before using PHP's include, the menu worked as it should.

At first, each .html page contained its own navigation bar code. However, I recently discovered PHP's "include" function. I copied the portion of code for the nav bar to navigation.php and used the PHP include statement in index.php (the original .html page). I have removed much of the unnecessary code:

<?php include("includes/navigation.php"); ?>

This is the only line of code within my index.php file.

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Invest for Hope - Donations</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" href="/assets/favicon.ico">
<link rel="apple-touch-icon" href="/assets/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="/assets/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="/assets/apple-touch-icon-114x114.png">
<link rel="shortcut icon" href="favicon.ico"> 
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>
<style type="text/css">html,body{height:100%;}.container-full{margin:0 auto;width:100%;min-height:100%;background-color:#110022;color:#eee;overflow:hidden;}.container-full a{color:#efefef;text-decoration:none;}.v-center{margin-top:7%;}[class^="cus-"],[class*=" cus-"]{display:inline-block;width:17px;height:16px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("/assets/social-icons-nav.png");background-position:14px 14px;background-repeat:no-repeat;opacity:0.5;}[class^="cus-"]:last-child,[class*=" cus-"]:last-child{*margin-left:0;}[class^="cus-"]:hover,[class*=" cus-"]:hover{opacity:1;}.cus-social-email{background-position:0 0;width:24px;height:24px;}.cus-social-facebook{background-position:-29px 0;width:24px;height:24px;}.cus-social-twitter{background-position:-58px 0;width:24px;height:24px;}.cus-social-youtube{background-position:-87px 0;width:24px;height:24px;}.btn-xlmain{width:310px;height:18px%;position:absolute;text-align:center;left:0;right:0;margin-left:auto;margin-right:auto;z-index:51;margin-top:-50px;}</style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
      <!-- Collect the nav links, forms, and other content for toggling -->
      <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav">
        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-user"></i> About<b class="caret"></b></a>
            <ul class="dropdown-menu">
                <li>
                    <a href="mission.html"> About</a>
                </li>
                <li>
                    <a href="team.html"> Team</a>
                </li>
            </ul>
        </li>
        <li>
        </ul>
    </div>
</nav>

This is all the code after removing most of it from the navigation.php file. Now, it only includes the dropdown menu and CSS to format the page.

If you want to view the actual issue with the dropdown menu, go to www.investforhope.org. The homepage is the display of the exact code I have shown.

  • 写回答

2条回答 默认 最新

  • douyan2470 2015-07-21 13:10
    关注

    Look at the source of the link you gave. You've commented out all your JS includes by omitting the closing comment tag used to remove .modal-dialog. Undo that error by adding the close comment marker --> after .modal-dialog's closing tag and it will work.

    This is what you have

    <!--
        <div class="modal-dialog">
        ...
        <script ... >
        ...
        </body>
    </html>
    

    no close-comment tag (though the browser may render one).

    This is what you should have, where </div> is the matching closing tag.

    <!--
        <div class="modal-dialog">
        ...
        </div> 
    -->
    <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    etc etc
    

    ALSO this line that isn't helping at all.

    <script>"js/bootstrap.js"</script>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog