<!DOCTYPE html>
<html lang="en">
<head>
  <title>Blasting off with Bootstrap</title>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-COMPATIBLE" content="IE=Edge"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <link rel="stylesheet" href="../css/bootstrap.min.css"/>
  <!--[if lt IE 9]>
  <script src="../js/html5shiv.3-7-0.js"></script>
  <script src="../js/respond.1-4-2.min.js"></script>
  <![endif]-->

  <style type="text/css">
    :focus {
      border-style: dotted !important;
      border-width: 2px !important;
      border-color: chartreuse !important;
    }
  </style>
</head>

<body>
<div class="modal fade" id="myModal">
  <!-- Sizing wrapper -->
  <!-- default width: 600px, modal-lg: 900px, modal-sm: 300px -->
  <div class="modal-dialog modal-sm">

    <!-- Content wrapper -->
    <div class="modal-content">

      <!-- Modal header -->
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">1 Welcome back!</h4>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
        <h1>1 Hello readers!</h1>
      </div>

      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">1 Close</button>
        <button type="button" class="btn btn-primary" data-dismiss="modal">1 Save</button>
      </div>
    </div>
  </div>
</div>

<div class="container">
  <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
    Trigger modal
  </button>

  <a href="11modal-content.html" class="btn btn-danger btn-lg" data-toggle="modal" data-target="#myModal">Remote A</a>

  <button type="button" class="btn btn-default btn-lg" onclick="openModal()">Remote JS</button>

  <h3>Try thi</h3>
  <ol>
    <li>Click first button</li>
    <li>Close modal</li>
    <li>Click second or third button</li>
    <li>Note the version loaded (1 or 2 ?)</li>
    <li>Reload page</li>
    <li>Click second or third button</li>
    <li>Close modal</li>
    <li>Click first button</li>
    <li>Note the version loaded (1 or 2 ?)</li>
    <li>Ponder</li>
  </ol>
</div>

<!-- https://ajax.googleapis.com/ajax/libs/jquery/1.11.1.jquery.min.js -->
<script src="../js/jquery-1.11.2.min.js"></script>
<script src="../js/bootstrap.js"></script>
<script type="text/javascript">
  function openModal() {
    var options = {
      // false: no backdrop, "static": do not close when clicking outside modal
      backdrop: "static",

      // enable ESC key to close modal
      keyboard: false,

      // show modal
      show: true,

      // href in the <a> handle of the modal is loaded in modal-body
      // FIXME this demo fails at making it work.
      remote: false
    };

    $('#myModal').modal(options);
  }

  $('#myModal').on('show.bs.modal', function () {
    console.log('Showing modal');
  });

  $('#myModal').on('shown.bs.modal', function () {
    console.log('Modal shown');
  });

  $('#myModal').on('hide.bs.modal', function () {
    console.log('Hiding modal');
  });

  $('#myModal').on('hidden.bs.modal', function () {
    console.log('Modal hidden');
  });

  $('#myModal').on('loaded.bs.modal', function () {
    console.log('Modal loaded');
  });

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