Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Open/close the widget

To open or close the widget, send an artificial click event to the widget button. It is possible to control the Widget programatically by calling the methods open() ,close() and toggle() on the gomeddo-button element.

Info

Do not add/remove CSS classes, as this will bypass the

...

Widget’s internal bookkeeping, resulting in strange behaviour.

...

Artificial click event example code

Opening the Widget

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

Closing the Widget

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

Toggling the Widget open/close

Code Block
languagejs
function toggleWidget() {
  const buttonwidget = document.querySelector('.booker25widget__btn'"gomeddo-button");
  if (buttonwidget) {
    buttonwidget.clicktoggle();
  }
}

...

Checking if the

...

Widget is open

Code Block
languagejs
function isWidgetOpen() {
  const iframewidget = document.querySelector('.booker25widget__iframe');"gomeddo-button");
  if (widget) {
    return iframe && iframe.classList.contains('booker25widget__iframe--hidden')widget.isOpen;
  }
  return false;
}