-
Hey there! I'm integrating Preline in an Elixir Phoenix app and while trying to avoid tooltips to get created multiple times I tried to use the Thanks for your help 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Seems like the HSTooltip's static autoInit() {
if (!window.$hsTooltipCollection) window.$hsTooltipCollection = [];
document.querySelectorAll('.hs-tooltip').forEach((el: HTMLElement) => {
if (
!window.$hsTooltipCollection.find(
(elC) => (elC?.element?.el as HTMLElement) === el,
)
)
new HSTooltip(el);
});
} This should be an open issue, I can't think why it wouldn't respect As a workaround, you could not document.querySelectorAll('.hs-tooltip:not(.--prevent-on-load-init)').forEach((el: HTMLElement) => {
if (
!window.$hsTooltipCollection.find(
(elC) => (elC?.element?.el as HTMLElement) === el,
)
)
new HSTooltip(el);
}); |
Beta Was this translation helpful? Give feedback.
Seems like the HSTooltip's
autoInit
method does not exclude elements with--prevent-on-load-init
class.This should be an open issue, I can't think why it wouldn't respect
--prevent-on-load-init
since as far as I'm aware the other plugins do.As a workaround, you could not
autoInit
thetooltip
collection and do this yourself somewhere in your code: