Spaces:
Running
Running
File size: 1,642 Bytes
d6b8d19 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
// see: https://popper.js.org/docs/v2/tutorial/
/* ========================================================================== */
/* ============================ show_Tooltip_Pop ============================ */
/* ========================================================================== */
function show_Tooltip_Pop() {
// Make the tooltip visible
tooltip.setAttribute('data-show', '');
// Enable the event listeners
popperInstance.setOptions((options) => ({
...options,
modifiers: [
...options.modifiers,
{ name: 'eventListeners', enabled: true },
],
}));
// Update its position
popperInstance.update();
}
/* ========================================================================== */
/* ============================ hide_Tooltip_Pop ============================ */
/* ========================================================================== */
function hide_Tooltip_Pop() {
// Hide the tooltip
tooltip.removeAttribute('data-show');
// Disable the event listeners
popperInstance.setOptions((options) => ({
...options,
modifiers: [
...options.modifiers,
{ name: 'eventListeners', enabled: false },
],
}));
}
function run_Pop(popcorn){
const showEvents_Tooltip_Pop = ['mouseenter', 'focus'];
const hideEvents_Tooltip_Pop = ['mouseleave', 'blur'];
// make sure that the tooltips are displayed and hidden when mouseenter and mouseleave
showEvents_Tooltip_Pop.forEach((event) => {
popcorn.addEventListener(event, show_Tooltip_Pop);
});
hideEvents_Tooltip_Pop.forEach((event) => {
popcorn.addEventListener(event, hide_Tooltip_Pop);
});
} |