w2popup.open

Opens a new popup or transitions to new content.
open([message], [options]);
message message, optional, Text message that will be centered.
options object, options for the popup
Returns a promise like object that has useful methods.

Description

The first argument message is the text message for the popup. If provided it will be merged into options as body of the popup and it will also be centered.
The second argument options is a map of properties for the popup (see overview page for valid options). Please note that options will not be replaces, but extended. If a popup is already displayed you can change the width/height (or any other property) in the following way: This method will trigger onOpen or onChange event depending if the popup was just opened or it was transitioned to the new content.

Examples

You can open popup defining everything in JavaScript Or from markup If you open it from markup, the width and height of the popup will be taken from the root markup element. It will also look for 3 sections for title [rel=title], body [rel=body] and buttons [rel=buttons].
IMPORTANT: If you open a popup from the markup that is already on the page, it will create two sets of same markup: one on the page and another one in the popup. It is better to load markup from a file.
Same rules apply if you load popup from the server. When you are loading from the server, you can optionally add #id at the end of your url. This allows to select a particular popup element, if server returns multiple in the same file. See load method.

User Comments

comments powered by Disqus