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

JavaScript
function openWidget() {
  const widget = document.querySelector("gomeddo-button");
  if (widget) {
    widget.open();
  }
}

Closing the Widget

JavaScript
function closeWidget() {
  const widget = document.querySelector("gomeddo-button");
  if (widget) {
    widget.close();
  }
}

Toggling the Widget open/close

JavaScript
function toggleWidget() {
  const widget = document.querySelector("gomeddo-button");
  if (widget) {
    widget.toggle();
  }
}

Checking if the Widget is open

JavaScript
function isWidgetOpen() {
  const widget = document.querySelector("gomeddo-button");
  if (widget) {
    return widget.isOpen;
  }
  return false;
}