ldc-nature-and-respect/resources/ts/modules/bsTooltips.ts

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-03-15 10:31:55 +01:00
import type * as bootstrap from "bootstrap";
/** ! Ignore here because there is no good TS vue mixin implementation at this time */
export default {
data(): {
_tooltips: Array<bootstrap.Tooltip>;
} {
return {
_tooltips: [],
};
},
methods: {
initTooltips() {
// @ts-ignore
if (this._tooltips) {
// @ts-ignore
this._tooltips.forEach((tooltip) => {
tooltip.disable();
tooltip.hide();
});
}
// @ts-ignore
this._tooltips = [].slice
.call(document.querySelectorAll("[data-bs-toggle=\"tooltip\"]"))
.map(function (tooltipTriggerEl) {
return new window.bootstrap.Tooltip(tooltipTriggerEl, {
customClass: "large-tooltip",
2023-05-03 12:42:19 +02:00
delay: {
show: 1250,
hide: 0,
},
2023-03-15 10:31:55 +01:00
});
});
},
},
};