-
Notifications
You must be signed in to change notification settings - Fork 39
Popup Maker JavaScript & jQuery API
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.
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.
Will open a popup with an ID # of 123.
PUM.open(123)
Will close a popup with an ID # of 123.
PUM.close(123)
Clears any Cookies attached to the popup with an ID # of 123.
PUM.clearCookies(123)
Open a popup, with an optional callback function.
jQuery('#pum-123').popmake('open', callback);
Close a popup
jQuery('#pum-123').popmake('close');
Reposition a popup to its starting location in the window, with an optional callback function.
jQuery('#pum-123').popmake('reposition', callback);
Retheme a popup, with an optional theme argument override.
jQuery('#pum-123').popmake('retheme', theme);
Animate a popup with style and optional callback.
jQuery('#pum-123').popmake('animate', style, callback);
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;
Runs when the popups are first initialized. Useful for checking settings and adding extra functionality runs just after document.ready.
Runs just before the popup is shown.
Runs just after the popup is shown.
Runs just before the popup is closed.
Runs just after the popup is closed.
Runs before repositioning the popup. Useful to change the position settings before it is moved.
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);