Programmatic Control of the Widget
It is possible to control the Widget programatically by calling the methods open()
,close()
and toggle()
on the gomeddo-button
element.
Do not add/remove CSS classes, as this will bypass the Widget’s internal bookkeeping, resulting in strange behaviour.
Opening the Widget
function openWidget() {
const widget = document.querySelector("gomeddo-button");
if (widget) {
widget.open();
}
}
Closing the Widget
function closeWidget() {
const widget = document.querySelector("gomeddo-button");
if (widget) {
widget.close();
}
}
Toggling the Widget open/close
function toggleWidget() {
const widget = document.querySelector("gomeddo-button");
if (widget) {
widget.toggle();
}
}
Checking if the Widget is open
function isWidgetOpen() {
const widget = document.querySelector("gomeddo-button");
if (widget) {
return widget.isOpen;
}
return false;
}