Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我可以一次点击关闭两个可折叠面板吗?_Javascript_Jquery_Angularjs_Css_Twitter Bootstrap 3 - Fatal编程技术网

Javascript 我可以一次点击关闭两个可折叠面板吗?

Javascript 我可以一次点击关闭两个可折叠面板吗?,javascript,jquery,angularjs,css,twitter-bootstrap-3,Javascript,Jquery,Angularjs,Css,Twitter Bootstrap 3,我的html文件中有3个面板。 第一个面板包含表行(始终打开)。当我按下任何表格行时,它旁边的一个新面板在右边打开(折叠),我们称它为第二个面板。 在第二个面板中,有一个按钮,单击该按钮后,第三个面板将在其右侧旁边打开(折叠)。 当三个面板打开并且我按下第一个面板中的表格行时,只有第二个面板关闭(折叠)。 有没有办法让第三个面板也关闭 <html> <head> <meta charset="utf-8">

我的html文件中有3个面板。 第一个面板包含表行(始终打开)。当我按下任何表格行时,它旁边的一个新面板在右边打开(折叠),我们称它为第二个面板。 在第二个面板中,有一个按钮,单击该按钮后,第三个面板将在其右侧旁边打开(折叠)。 当三个面板打开并且我按下第一个面板中的表格行时,只有第二个面板关闭(折叠)。 有没有办法让第三个面板也关闭

     <html> 
        <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.2/angular.min.js"></script> 
    </head>
    <body>
              
    <div class="row">
    <!-- First Panel -->
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">First Panel</div>
            	      <div class="panel-body">
            	          <table class="table table-striped">
            	              <thead>
            	                  <tr>
            	                      <th>Name</th>
            	                  </tr>
            	              </thead>
            	              <tbody>
            	                  <tr>
            	                      <td><a data-toggle="collapse"                                                     href="#secondPanel">open second     panel</a>                                     </td>
            	                  </tr>
            	              </tbody>
            	          </table>	
            	      </div>
                </div>
            </div>
            		
            <!-- Second Panel -->
            <div class="col-md-4">
                <div class="panel panel-default panel-collapse collapse"                         id="secondPanel">
                    <div class="panel-heading">Second Panel</div>
                        <div class="panel-body">
                            <table class="table table-striped">
                                <thead>
                                </thead>
                                <tbody>
                                   <button type="button" class="btn btn-primary"                                    data-toggle="collapse"                                                            href="#thirdPanel">Reply</button>			
                                </tbody>
                            </table>					
                        </div>
                    </div>
            </div>
            <!-- Third Panel -->
            <div class="col-md-4">
                <div class="panel panel-default panel-collapse collapse"                         id="thirdPanel">
                    <div class="panel-heading">Third Panel</div>
                        <div class="panel-body">
                            <table class="table table-striped">
                                <thead>
                                </thead>
                                <tbody>
                                    <div class="well well-sm">some text</div>
           	                    </tbody>
                            </table>	
                        </div>
                    </div>
                </div>
            </div>
        </body>
    </html>
        
        


第一小组
名称
第二小组
回复
第三小组
一些文本

您可以通过JavaScript实现:
$('.collapse').collapse()
@DanEpp这是JQuery,不是rawJavascript@BenWainwright有一个“jquery”标记,但你是对的@我添加了我的代码,请帮忙。谢谢:)@fiscsp这不是棱角。您没有角度模块(
ngApp
),也没有控制器和视图。如果您想使用angular,那么可以从这个折叠示例开始