选项卡中的选项卡使用bootstrap 3无法正常工作

时间:2014-02-20 19:54:59

标签: php jquery css twitter-bootstrap tabs

我正在开发一个网页,我计划在主菜单标签上为其中一个标签设置两个菜单标签。我可以让子菜单选项卡显示在页面上。所有选项卡都会正确填充内容。但是,我无法在标签之间导航。我发布了以下代码,我发布了标签:

的header.php

                <div class="row clearfix">
                        <div class="col-md-12 column">
                                <div class="tabbable boxed parentTabs" id="mainmenutab">
                                        <ul class="nav nav-tabs">

                                                <?php include "mainmenu_links.php"; ?>

                                                <li class="dropdown" onclick="dropdownuserlogin()">
                                                        <?php include "userlogin.php"; ?>
                                                </li>
                                        </ul>
                                </div>
                        </div>
                </div>
        </div>

<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.js"></script>
<script>
function dropdownuserlogin(e){
$('.dropdown-toggle').dropdown();
$('#userlogin').dropdown('toggle');
}   


$("ul.nav-tabs a").click(function (e) {
  e.preventDefault();  
$(this).tab('show').addClass('active');
});


</script>
</body>
</html> 

mainmenu_links.php:

    <?php
$main = $_GET['main']; $sub = $_GET['sub']; /*echo $main; echo $sub;*/

$main_menu=array("Home"=>"files/home_page.php?main=1&sub=1",
                "Submit a New Project"=>"files/form_page.php?main=2&sub=2",
                "All Projects"=>"myday/.view_table.php?main=3&sub=1",
                "Innovations"=>"files/ideafactory.php?main=4&sub=4",
                "Share your learning"=>"files/shareyourlearning.php?main=5&sub=5",
                "Meet the Team"=>"files/team.php?main=6&sub=6");

$i = 1;
foreach($main_menu as $key => $value){
        if($i == "1"){
                echo "<li class=\"active\"><a href=\"../".$value."\"";
                if($main == "1" | $main==null){
                         echo " class=\"selected\"";
                }
                echo ">".$key."</a></li>";
        }
        else{
                echo "<li><a href=\"../".$value."\"";
                if($main == $i){
                         echo " class=\"selected\"";
                }
                echo ">".$key."</a></li>";
                $i++;
        }
}

?>

projects_menulinks.php

<?php
$main = $_GET['main']; $sub = $_GET['sub'];
$sub_menu=array("Myday"=>"myday/.view_table.php?main=3&sub=1",
                "Techpulse"=>"techpulse/.view_table.php?main=3&sub=2",
                "BrownBag Sessions"=>"brownbag/.view_table.php?main=3&sub=3");

$i = 1;
                        foreach($sub_menu as $key => $value){
                                if($sub == "1"){
                                        echo "<li class=\"active\"><a href=\"../".$value."\"";
                                        echo ">".$key."</a></li>";
                                }
                                else{
                                        echo "<li><a href=\"../".$value."\"";
                                        echo ">".$key."</a></li>";
                                }
                        }
?>

我认为我正在搞乱使用标签声明。有人可以让我知道我做错了什么。

0 个答案:

没有答案