Currently, I am utilizing the tooltipster.js library to create tooltips and attempting to adjust the default distance of the tooltip based on various screen sizes.
Initially, the initialization appears as follows:
$(inputTooltipTrigger).tooltipster({
distance: 24,
theme: 'test',
trigger: 'custom'
});
If the width of the window exceeds 641px, then the distance is modified to 6
if ($(window).width() > 641){
$(inputTooltipTrigger).tooltipster({
distance: 6,
theme: 'test',
trigger: 'custom'
});
}
Upon resizing the window to a width greater than 641px, the distance also changes to 6
$(window).resize(function(){
if ($(window).width() > 641){
$(inputTooltipTrigger).tooltipster({
distance: 6,
theme: 'test',
trigger: 'custom'
});
}
});
I am seeking a solution for reinitializing the plugin when the window is resized and its width exceeds 641px. While I attempted using CSS, it required the !important
flag to override the inline JS from the tooltip plugin, which is generally discouraged.