2013/09/01

Bootstrap accordion

accordion效果就像手風琴一樣拉上拉下


在拉的時候,總會有一個地方會顯示出來
要記得,jquery要使用1.9以上的版本喔


<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Test</title>
        <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
        <script src="./js/bootstrap.js"></script>
        <link rel="stylesheet" href="./css/bootstrap.css">
    </head>
    <body>
        <div class="panel-group" id="accordion">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h4 class="panel-title">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
                  Collapsible Group Item #1
                </a>
              </h4>
            </div>
            <div id="collapseOne" class="panel-collapse collapse in">
              <div class="panel-body">
                one
              </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
              <h4 class="panel-title">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
                  Collapsible Group Item #2
                </a>
              </h4>
            </div>
            <div id="collapseTwo" class="panel-collapse collapse">
              <div class="panel-body">
                Two
              </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
              <h4 class="panel-title">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
                  Collapsible Group Item #3
                </a>
              </h4>
            </div>
            <div id="collapseThree" class="panel-collapse collapse">
              <div class="panel-body">
                Three
              </div>
            </div>
        </div>
      </div>
    </body>
</html>

執行結果



參考資料:
http://getbootstrap.com/javascript/#collapse

圖片參考:
http://www.rolandus.com/products/details/1072