Popups API

Introduction to Breakdance’s Simple Popup API

In this tutorial, we will explore the simple popup API that Breakdance offers, which allows you to trigger the opening and closing of specific pop-ups. This feature is particularly useful for developers wanting to interact with the popup’s open or close state via third-party code.

Identifying the Popup ID

To start with, it is essential to know the ID of the popup you want to open or close.

  1. Navigate to the Breakdance popup section in the WordPress Admin panel.
  2. Hover over the name of the popup you want to interact with.
  3. Note the number that appears next to the name (e.g., 16). This is the popup ID.

Working with the API

The API has one method available: BreakdancePopup.runAction.

This method accepts two arguments:

  1. The ID of the popup you want to interact with.
  2. The name of the action you want to trigger. This can be either ‘open’ or ‘close’.

Below is an example of using the API to open a popup.