Popup Maker jQuery API

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 #1.

Global Functions

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

PUM.getPopup('#pum-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, respectively.

PUM.open(123)

PUM.close: Will close a popup with an ID # of 123, respectively.

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 optional callback function.

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

close: Close a popup:

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

reposition: Reposition a popup to its starting location in the window, with optional callback function:

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

retheme: Retheme a popup, with optional theme argument override.

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

animate: Animate a popup with style and optional callback:

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

Access Settings

All of a popups 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-1').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 initilized. 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 re positioning 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);

The Full code is very readable and accessible on GitHub. Fully built to be extended.
https://github.com/PopupMaker/Popup-Maker/blob/master/assets/js/site.js

Still need help? Contact Us Contact Us