opening with button | WordPress.org

[ad_1]

Trying to implement tidio chat with a different button. It is working with a few problems. Here is the script i used. I added the touchstart to make it work on a mobile as click click event didnt work on mobile.

(function() {
function onTidioChatApiReady() {
window.tidioChatApi.hide();
window.tidioChatApi.on("close", function() {
window.tidioChatApi.hide();
});
}
if (window.tidioChatApi) {
window.tidioChatApi.on("ready", onTidioChatApiReady);
} else {
document.addEventListener("tidioChat-ready", onTidioChatApiReady);
}
document.querySelector(".fm-item-2-4").addEventListener("click", function() {
window.tidioChatApi.show();
window.tidioChatApi.open();
});
document.querySelector(".fm-item-2-4").addEventListener("touchstart", function() {
window.tidioChatApi.show();
window.tidioChatApi.open();
});
})();

Issue 1 – On mobile it functions great, opens etc. If you swipe left or right to close the chat, the browser is not scrollable and kind of frozen. Links still are clickable on the page but can not scroll. If you click close on the chat, all works as expected.

Issue 2 – works as expected on desktop on any non woocommerce pages. On woocommerce pages it opens then quickly closes.

Any suggestions? im not good with javascipt so maybe I have an issue there

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer