Returns an instance of a popup component that displays an article next to a target DOM node.

Example

var target = document.getElementById('popup-component-target');
var popup = window._elev.popupComponent(target, { articleId: '81565' });
popup.insert();
// popup._destroy();

Signature

window._elev.popupComponent(target, options);

target (required)

The DOM node that the popup will appear next to.

options (required)

  • options.articleId (required)
    The ID of the article that should be displayed.

Instance

A popup component instance has the following methods:

insert

Inserts the component into the DOM as a new element and attempts to position itself at the top right of the target. Equivalent to “opening” the popup.

_destroy

Undoes insert logic and destroys component. Instance cannot be used after this is called. Equivalent to “closing” the popup; to “open” it again, create a new popup and insert it.

If you use this API or have suggestions for it’s improvement please get in touch about your experience.