-
Notifications
You must be signed in to change notification settings - Fork 38
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)
Used to prevent any further attempts of a particular popup to open for the current page load.
PUM.preventOpen(123)
Get a JavaScript object containing the given popup's settings.
PUM.getSettings(123)
Get a setting for specified popup by key. Optionally provide a default value.
PUM.getSetting(123, 'location', 'bottom center')
Returns true or false based on popups targeting conditions.
PUM.checkConditions(123)
Get a cookie by name.
PUM.getCookie('pum-123')
Set a cookie by name with optional expiration and path.
- Expiration uses PHP strtotime format prefixed by +.
PUM.setCookie(123, {expires: "+1 week", path: "/"})
Clear a cookie by name with an optional callback.
PUM.clearCookie('pum-123')
Clear all cookies for a given popup.
PUM.clearCookies(123)
Returns a valid CSS click trigger selector for all of popup #123's click triggers.
PUM.getClickTriggerSelector(123, {extra_selectors: '#custom-selector'}) //
Disables all click triggers for a given popup, with optional extra CSS selectors.
PUM.disableClickTriggers(123, {extra_selectors: '#custom-selector'}) //
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 pum_vars.popups
global, organized by ID. data-popmake
attribute.
// Get the settings from our global API.
PUM.getSettings(123);
// Get specific settings from global API.
PUM.getSetting(123, 'triggers', []);
All admin settings are stored in the snake_case format, such as position_left
.
// The id of the popup. Useful for checking if a certain popup is loading to attach settings.
settings.id
settings.slug
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);