bootstrap使用汇总

时间:2023-03-09 16:42:16
bootstrap使用汇总

//大多数功能都能够指定data属性来指定 但是,有必要的情况下使用jquery由于事件是不同的过程

//活动通常有两种状态show shown 通用和过去的





<!DOCTYPE html>

<html lang="en">





  <head>

    <title>Bootstrap 101 Template</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Bootstrap -->

    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">

    <link href="css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">





      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">

      </script>

      <script>

          $(document).ready(function(){

              $("p").click(function(){

                  $(this).hide();

              });

              //通过编写jquery 来展示效果,方法和事件的使用

              //$("#myModal").modal({show:true,backdrop:true});

              $('#myModal').on('shown', function () {

                  alert("hahjah");

              })

          });

      </script>





  </head>

  <body>





//通过data属性来查看效果

<!-- Button to trigger modal -->

<a href="#myModal" role="button" class="btn" data-toggle="modal">查看演示案例</a>

//指定data属性data-backdrop backdrop是一个可选參数。能够看文档还有非常多实用的属性

<button type="button" data-backdrop="false" data-toggle="modal" data-target="#myModal">Launch modal</button>

<!-- Modal -->

<div id="myModal"  class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

    <div class="modal-header">

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

        <h3 id="myModalLabel">Modal header</h3>

    </div>

    <div class="modal-body">

        <p>One fine body…</p>

    </div>

    <div class="modal-footer">

        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>

        <button class="btn btn-primary">Save changes</button>

    </div>

</div>

<p>假设您点击我。我会消失。</p>





<!--***************************************************************************-->

    <script src="http://code.jquery.com/jquery.js"></script>

    <script src="js/bootstrap.min.js"></script>

  </body>

</html>

版权声明:本文博主原创文章。博客,未经同意不得转载。