You should replace your current script in the Custom JS field with the new one:
const originalContainerSelector = "[class*='FloatingButton__FloatingButtonContainer-sc']";
const originalButtonSelector = "button[role='button']";
const newContainerClass = "FloatingButton__FakeContainer";
const newButtonHTML = `
<button class="widgetLabel tidio-1cr1ym5 moveFromRightLabel-enter-done" type="button"
style="
all: unset;
display: inline-flex;
align-items: center;
justify-content: center;
background-color: white;
border-radius: 16px;
padding: 10px 15px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
cursor: pointer;
font-family: Arial, sans-serif;
text-align: center;
">
<span style="white-space: nowrap; font-size: 17px; line-height: 17px;">
Click for Help! 😁
</span>
</button>
`;
const pulseAnimation = {
keyframes: [
{ transform: 'scale(1)', opacity: 0, offset: 0 },
{ opacity: 1 },
{ transform: 'scale(1.2)', opacity: 0 }
],
timing: {
duration: 1000,
iterations: 3,
easing: 'linear'
}
};
function waitForElement(selector, root = document, maxAttempts = 50, interval = 100) {
return new Promise((resolve, reject) => {
let attempts = 0;
const check = () => {
const element = root.querySelector(selector);
if (element) {
resolve(element);
} else if (attempts < maxAttempts) {
attempts++;
setTimeout(check, interval);
} else {
reject(new Error(`Element ${selector} wasn't found`));
}
};
check();
});
}
function addNewFloatingContainer(originalContainer) {
const originalButton = originalContainer.querySelector(originalButtonSelector);
if (!originalButton) return;
const newContainer = document.createElement("div");
newContainer.className = newContainerClass;
newContainer.style.cssText = `
position: fixed;
bottom: 35px;
right: 100px;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
`;
const animationFrame = document.createElement("div");
animationFrame.classList.add("es-animation-frame");
const secondAnimationFrame = animationFrame.cloneNode(true);
animationFrame.animate(pulseAnimation.keyframes, pulseAnimation.timing);
setTimeout(() => secondAnimationFrame.animate(pulseAnimation.keyframes, { ...pulseAnimation.timing, iterations: 2 }), 500);
setInterval(() => {
animationFrame.animate(pulseAnimation.keyframes, pulseAnimation.timing);
setTimeout(() => secondAnimationFrame.animate(pulseAnimation.keyframes, { ...pulseAnimation.timing, iterations: 2 }), 500);
}, 5000);
const fakeButtonWrapper = document.createElement("div");
fakeButtonWrapper.innerHTML = newButtonHTML;
const fakeButton = fakeButtonWrapper.firstElementChild;
fakeButton.addEventListener("click", () => {
originalButton.click();
});
newContainer.append(fakeButton, animationFrame, secondAnimationFrame);
originalContainer.parentNode.insertBefore(newContainer, originalContainer.nextSibling);
}
waitForElement(originalContainerSelector)
.then((originalContainer) => {
addNewFloatingContainer(originalContainer);
})
.catch(() => {});
And this code should be added to the Custom CSS field:
.global-styles,
.es-animation-frame {
position: absolute;
inset: 0;
opacity: 0;
z-index: 0;
width: 100%;
height: 100%;
border-radius: 100px;
border: 1px solid rgba(17, 17, 17, 0.5);
pointer-events: none;
}
The color of the animation is set on the 10th line of this code:
Give it a shot and let me know if it worked 