Retrospring/app/javascript/retrospring/initializers/bootstrap.ts

18 lines
674 B
TypeScript
Raw Normal View History

2023-01-04 03:23:00 -08:00
import * as bootstrap from 'bootstrap';
/**
* This module sets up Bootstrap's JavaScript
*
* Inside of the exported function below, initialize Bootstrap
* modules that require explicit initilization, like tooltips
*/
export default function (): void {
document.addEventListener('turbo:load', () => {
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
2023-01-04 08:31:19 -08:00
[...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
2023-01-04 03:23:00 -08:00
const dropdownElementList = document.querySelectorAll('.dropdown-toggle');
2023-01-04 08:31:19 -08:00
[...dropdownElementList].map(dropdownToggleEl => new bootstrap.Dropdown(dropdownToggleEl));
2023-01-04 03:23:00 -08:00
});
}