隐藏引导表单并使用分页

时间:2017-02-25 17:19:39

标签: javascript jquery html css twitter-bootstrap

这对你们所有人来说都很容易,但我不明白为什么我的表格在底部添加用户输出即使我在我的ul类中添加分页它会在下拉列表中添加设计但是仍然有一个表单我尝试用jquery隐藏它,但如果我显示和隐藏元素,它将需要很多.show和.hide希望它被总结并隐藏表单

            <!DOCTYPE html>
            <html lang="en">
              <head>
                <meta charset="utf-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <meta name="description" content="SHIELD - Free Bootstrap 3 Theme">
                <meta name="author" content="Carlos Alvarez - Alvarez.is - blacktie.co">
                <link rel="shortcut icon" href="assets/ico/favicon.png">


                <!-- Bootstrap core CSS -->
                <link href="assets/css/bootstrap.css" rel="stylesheet">

                <!-- Custom styles for this template -->
                <link href="assets/css/main.css" rel="stylesheet">
                <link rel="stylesheet" href="assets/css/icomoon.css">
                <link href="assets/css/animate-custom.css" rel="stylesheet">



                <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic' rel='stylesheet' type='text/css'>
                <link href='http://fonts.googleapis.com/css?family=Raleway:400,300,700' rel='stylesheet' type='text/css'>

                <script src="assets/js/jquery.min.js"></script>
                <script type="text/javascript" src="assets/js/modernizr.custom.js"></script>

                <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
                <!--[if lt IE 9]>
                  <script src="assets/js/html5shiv.js"></script>
                  <script src="assets/js/respond.min.js"></script>
                <![endif]-->
              </head>

              <body data-spy="scroll" data-offset="0" data-target="#navbar-main">


                <div id="navbar-main">
                  <!-- Fixed navbar -->
                <div class="navbar navbar-inverse navbar-fixed-top" >
                  <div class="container">
                    <div class="navbar-header">
                      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon icon-shield" style="font-size:30px; color:#3498db;"></span>
                      </button>
                      <a class="navbar-brand hidden-xs hidden-sm" href="#home"><span class="icon icon-shield" style="font-size:18px; color:#3498db;"></span></a>
                    </div>
                    <div class="navbar-collapse collapse">
                      <ul class="nav navbar-nav" style = "font-weight:strong; font-family:Verdana;">
                        <li><a href="index.html" class="smoothScroll">Home</a></li>
                        <li> <a href="#about" class="smoothScroll"> About</a></li>
                        <li> <a href="#services" class="smoothScroll"> Services</a></li>
                        <li> <a href="#team" class="smoothScroll"> Team</a></li>
                        <li> <a href="#portfolio" class="smoothScroll"> Portfolio</a></li>
                        <li> <a href="#blog" class="smoothScroll"> Blog</a></li>
                        <li> <a href="#contact" class="smoothScroll"> Contact</a></li></ul>
                        <div style = "position:relative; left:550px;">
                            <ul class="nav navbar-nav" style = "font-weight:strong; font-family:Verdana; margin-right:0px;">
                                <li> <a href="index.html" class="smoothScroll"> Logout</a></li>
                                </ul>
                        </div>




                    </div>
                  </div>
                </div>
                </div>
            <!--/.nav-collapse -->

            <nav class="navbar navbar-default sidebar" role="navigation">
                <div class="container-fluid">
                <div class="navbar-header">
                  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-sidebar-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                  </button>      
                </div>
                <div class="collapse navbar-collapse" id="bs-sidebar-navbar-collapse-1">
                  <ul class="nav navbar-nav">
                    <li class="active"><a href="#home">Home<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-home"></span></a></li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown">Manage Users<span class="caret"></span><span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-user"></span></a>
                      <ul class="dropdown-menu forAnimate" role="menu">
                        <li><a href="#" data-target = "#home" data-toggle="collapse">Add</a></li>
                        <li><a href="#">Edit Employee Information</a></li>
                        <li><a href="#">Report</a></li>
                        <li class="divider"></li>
                        <li><a href="#">All Users</a></li>
                        <li class="divider"></li>
                        <li><a href="#">Audit Trail</a></li>
                      </ul>
                    </li>          
                    <li ><a href="#">Announcements<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-bullhorn"></span></a></li>        
                    <li ><a href="#">Orders<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-shopping-cart"></span></a></li>
                    <li ><a href="#">Stocks<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-th-list"></span></a></li>
                  </ul>

                </div>
              </div>
            </nav>
            <form id = "home">
              <!-- ==== PORTFOLIO ==== -->
                    <div class="container" id="portfolio" name="portfolio">
                    <br>
                        <div class="row">
                            <br>
                            <h1 class="centered">Admin</h1>
                            <hr>
                            <br>
                            <br>
                        </div><!-- /row -->
                        <div class="container">

                        <div class="row">   

                        </div>
                        </div>
                    </div>
            </form>
            <form id = "adduser">
              <!-- ==== PORTFOLIO ==== -->
                    <div class="container" id="portfolio" name="portfolio">
                    <br>
                        <div class="row">
                            <br>
                            <h1 class="centered">Add User</h1>
                            <hr>
                            <br>
                            <br>
                        </div><!-- /row -->
                        <div class="container">

                        <div class="row">   

                        </div>
                        </div>
                    </div>
            </form>         

            <!-- Bootstrap core JavaScript
                ================================================== -->
                <!-- Placed at the end of the document so the pages load faster -->


                <script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
                <script type="text/javascript" src="assets/js/retina.js"></script>
                <script type="text/javascript" src="assets/js/jquery.easing.1.3.js"></script>
                <script type="text/javascript" src="assets/js/smoothscroll.js"></script>
                <script type="text/javascript" src="assets/js/jquery-func.js"></script>
                <script>
                $(document).ready(function(){
                    $("#adduser").hide();
                });
                </script>
              </body>
            </html>

如果我点击主页,将显示管理表单,如果我点击添加添加表单将显示,管理表单将被隐藏

1 个答案:

答案 0 :(得分:0)

您要实现的是动态页面导航(不是分页)

一般想法: Demo

<!-- Nav tabs -->
<ul class="nav nav-tabs" id="nav">
  <li><a href="#add" data-toggle="tab">Add</a></li>
  <li><a href="#edit" data-toggle="tab">Edit</a></li>
  <li><a href="#report" data-toggle="tab">report</a></li>
</ul>

<!-- Tab panes -->
<div class="tab-content">
  <div class="tab-pane" id="add">This is add</div>
  <div class="tab-pane" id="edit">This is edit</div>
  <div class="tab-pane" id="report">This is report</div>
</div>

我将此应用于您的示例here。希望这有助于