Advertisement
isaacadams

Modal

Jul 23rd, 2021
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.  
  5. <head>
  6.  
  7. <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
  8.  
  9. <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
  10.  
  11. <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
  12.  
  13.  
  14.  
  15.  
  16. <script>
  17.  
  18. var myModal = new bootstrap.Modal(document.getElementById('StaticModal'), options)
  19.  
  20.  
  21.  
  22.  
  23. </script>
  24.  
  25. </head>
  26.  
  27. <body>
  28.  
  29. <div class="container">
  30.  
  31. <h3>Bootstrap 5 Modal Example</h2>
  32.  
  33.  
  34.  
  35.  
  36. <!-- Trigger Modal Component -->
  37.  
  38. <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#StaticModal">
  39.  
  40. Modal with Popover and Tooltips.
  41.  
  42. </button>
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. <!-- Modal -->
  51.  
  52. <div class="modal fade" id="StaticModal" tabindex="-1" aria-labelledby="basicModalLabel" aria-hidden="true">
  53.  
  54. <div class="modal-dialog modal-dialog-centered">
  55.  
  56. <div class="modal-content">
  57.  
  58. <div class="modal-header">
  59.  
  60. <h5 class="modal-title" id="basicModalLabel">Modal with Popover/Tooltips</h5>
  61.  
  62. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  63.  
  64. </div>
  65.  
  66. <div class="modal-body">
  67.  
  68. <h5>Popover in a modal</h5>
  69.  
  70.  
  71.  
  72.  
  73. <p>Click on this <a href="#" role="button" class="btn btn-primary btn-lg popover-example" title="Title of the Popover" data-bs-content="Place the content of popover here">button</a> to open the popover</p>
  74.  
  75. <hr>
  76.  
  77. <h5>Tooltips in a modal</h5>
  78.  
  79. <p><a href="#" class="tooltip-example" data-bs-toggle="tooltip" title="Tooltip">This link</a> and <a href="#" class="tooltip-example" data-bs-toggle="tooltip" title="Tooltip">that link</a> have tooltips on hover.</p>
  80.  
  81. </div>
  82.  
  83. <div class="modal-footer">
  84.  
  85. <button type="button" class="btn btn-primary">Yes</button>
  86.  
  87. <button type="button" class="btn btn-primary">No</button>
  88.  
  89. <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
  90.  
  91. </div>
  92.  
  93. </div>
  94.  
  95. </div>
  96.  
  97. </div>
  98.  
  99.  
  100.  
  101.  
  102. </div>
  103.  
  104.  
  105.  
  106.  
  107. <script>
  108.  
  109. var popover = new bootstrap.Popover(document.querySelector('.popover-example'), {
  110.  
  111. container: 'body'
  112.  
  113. })
  114.  
  115.  
  116.  
  117.  
  118. var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
  119.  
  120.  
  121.  
  122.  
  123. var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  124.  
  125. return new bootstrap.Tooltip(tooltipTriggerEl)
  126.  
  127. })
  128.  
  129. </script>
  130.  
  131. </body>
  132.  
  133. </html>
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement