Skip to main content
Skip table of contents

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

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

Closing the Widget

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

Toggling the Widget open/close

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

Checking if the Widget is open

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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.