i have a reusable element on my bubble app that is triggered through a custom event to appear as informational text right next to the element it was clicked on. The reusable element is a floating group type of element. Now, inside of the custom event i have this javascript code: "var trigger = document.getElementById(‘id of the element’);
var panel = document.getElementById(‘InformationalText’);
var rect = trigger.getBoundingClientRect();
panel.style.position = ‘absolute’;
panel.style.left = (rect.right + window.scrollX) + ‘px’; // Align right side
panel.style.top = (rect.top + window.scrollY) + ‘px’; // Align top side
panel.style.display = ‘block’; // Make sure the panel is visible
document.addEventListener(‘click’, function(event) {
var isClickInsideTrigger = trigger.contains(event.target);
var isClickInsidePanel = panel.contains(event.target);
if (!isClickInsideTrigger && !isClickInsidePanel) {
panel.style.display = ‘none’;
}
});" and it’s the last action of the custom event, the process is working for one page but for other page it’s not even when the actions, custom events and elements are the same. what could be the source of error? help me troubleshoot