Skip to content

Commit 0488f34

Browse files
michael-wisely-gravwellivanov
authored andcommitted
Make bootstrap globally available (pydata#1639)
* Make bootstrap globally available * Include docs about bootstrap programmatic API
1 parent aa5bcae commit 0488f34

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/community/topics/bootstrap.rst

+1
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ JavaScript
6060
^^^^^^^^^^
6161

6262
- Data attributes for all JavaScript plugins are now namespaced to help distinguish Bootstrap functionality from third parties and your code. For example, we use ``data-bs-toggle`` instead of ``data-toggle``.
63+
- Bootstrap's `Programmatic API <https://getbootstrap.com/docs/5.0/getting-started/javascript/#programmatic-api>`_, ``bootstrap``, is also available. This API can be useful for initializing opt-in components that are not initialized by default such as `Popovers <https://getbootstrap.com/docs/5.0/components/popovers/#overview>`_.

src/pydata_sphinx_theme/assets/scripts/bootstrap.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Import and setup functions to control Bootstrap's behavior.
22
import "@popperjs/core";
3-
import { Tooltip } from "bootstrap";
3+
import * as bootstrap from "bootstrap";
44
import { documentReady } from "./mixin";
55

66
import "../styles/bootstrap.scss";
@@ -17,7 +17,9 @@ function TriggerTooltip() {
1717
document.querySelectorAll('[data-bs-toggle="tooltip"]')
1818
);
1919
tooltipTriggerList.map(function (tooltipTriggerEl) {
20-
return new Tooltip(tooltipTriggerEl, { delay: { show: 500, hide: 100 } });
20+
return new bootstrap.Tooltip(tooltipTriggerEl, {
21+
delay: { show: 500, hide: 100 },
22+
});
2123
});
2224
}
2325

@@ -54,3 +56,5 @@ function showBackToTop() {
5456
documentReady(TriggerTooltip);
5557
documentReady(backToTop);
5658
documentReady(showBackToTop);
59+
60+
window.bootstrap = bootstrap;

0 commit comments

Comments
 (0)