Skip to content

Popup Maker JavaScript & jQuery API

Daniel L. Iser edited this page Feb 17, 2021 · 3 revisions

General Information

Each popup is initialized separately already during page load. The following methods are used by using the popups id for the selector. All examples use ID #123.

Global Functions

PUM.getPopup

Returns a valid popup even if you pass in a child of that popup.

PUM.getPopup(123); // Returns the popup with ID #123.
PUM.getPopup('#pum-123'); // Returns popup with ID 123.
PUM.getPopup('#my-popup-form'); // Returns the parent popup of your form, or false if the form isn't in a popup.

PUM.open

Will open a popup with an ID # of 123.

PUM.open(123)

PUM.close

Will close a popup with an ID # of 123.

PUM.close(123)

PUM.clearcookies

Clears any Cookies attached to the popup with an ID # of 123.

PUM.clearCookies(123)

Methods

open

Open a popup, with an optional callback function.

jQuery('#pum-123').popmake('open', callback);

close

Close a popup

jQuery('#pum-123').popmake('close');

reposition

Reposition a popup to its starting location in the window, with an optional callback function.

jQuery('#pum-123').popmake('reposition', callback);

retheme

Retheme a popup, with an optional theme argument override.

jQuery('#pum-123').popmake('retheme', theme);

animate

Animate a popup with style and optional callback.

jQuery('#pum-123').popmake('animate', style, callback);

Access Settings

All of a popup's public settings are stored in the data-popmake attribute. This can be accessed using jQuery's .data() function.

// Get the settings for a specific popup.
var settings = jQuery('#pum-123').data('popmake');

// Or if in one of our events you can use
var settings = jQuery(this).data('popmake');

All admin settings are stored in the meta key.

// The id of the popup. Useful for checking if a certain popup is loading to attach settings.
settings.id;

// Contains all the close settings.
settings.meta.close;

// Contains all display settings.
settings.meta.display;

// Whether Esc Press is checked on Close Options.
settings.meta.close.esc_press;

// The selected size.
settings.meta.display.size;

Events

pumInit

Runs when the popups are first initialized. Useful for checking settings and adding extra functionality runs just after document.ready.

pumBeforeOpen

Runs just before the popup is shown.

pumAfterOpen

Runs just after the popup is shown.

pumBeforeClose

Runs just before the popup is closed.

pumAfterClose

Runs just after the popup is closed.

pumBeforeReposition

Runs before repositioning the popup. Useful to change the position settings before it is moved.

Properties

last_open_trigger

Contains either reference to the original click trigger or a string of settings for the trigger used.

jQuery.fn.popmake.last_open_trigger;


// Use something like try {} catch (Error); In case the selector is from Auto Open for instance.
try {
     trigger = $($.fn.popmake.last_open_trigger);
} catch (Error);