Jelajahi Sumber

Chapter 4: popovers.

Frederic G. MARAND 9 tahun lalu
induk
melakukan
32c2dc327d
1 mengubah file dengan 63 tambahan dan 0 penghapusan
  1. 63 0
      chapter4/09popover.html

+ 63 - 0
chapter4/09popover.html

@@ -0,0 +1,63 @@
+<!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-radius: 25%;
+    }
+  </style>
+</head>
+
+<body>
+<div class="container">
+  <input type="button" value="Premier" />
+  <button type="button" class="btn btn-default popoverButton"
+          title="This is a demo popover"
+          data-toggle="popover" data-placement="bottom" data-content="Lorem ipsum dolor">
+        Click me!
+  </button>
+</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">
+  var options = {
+    animation: true,
+    placement: "right",
+    // Inclure "focus" pour l'accessibilité.
+    trigger: "hover focus click" // "hover focus", "hover click" ...
+  };
+
+  // or options = "show"|"hide"|"toggle"|"destroy"
+
+  $(document).ready(function () {
+    $('.popoverButton').popover(options);
+  });
+
+  $('.popoverButton').on('show.bs.popover', function () {
+    console.log('Showing popover');
+  });
+  $('.popoverButton').on('shown.bs.popover', function () {
+    console.log('Popover shown');
+  });
+  $('.popoverButton').on('hide.bs.popover', function () {
+    console.log('Hiding popover');
+  });
+  $('.popoverButton').on('hidden.bs.popover', function () {
+    console.log('Popover hidden');
+  });
+</script>
+</body>
+</html>