- Node: This is a DOM Node. Example: document.getElementById('dropdown-button').
- Array / String: This is either, an Array of Strings or a single String. The String(s) here are events. Example: ["click", "mouseover"] / "focus". (These events are in events)
- Array / String: This is either, an Array of Strings or a single String. The String(s) here are events. Example: ["click", "mouseout"] / "blur". (These events are out events) [optional parameter]
- Bind all the in events (2nd parameter) to the Node (1st parameter).
- On the firing of any of the above attached events, deploy the pop with remaining parameters as to be done without binder.
- If out events has been specified, attach all the out events to the Node; which on firing will cause pop to be outted.
- Attach all the in events to the Node; which on firing will cause the pop to be outted.
Example (taken from the demo page):
var dropdown_button = document.getElementById('demo-dropdown');
PS.pop(
"general",
'<ul><li>About</li><li>Help</li><li>Log Out</li></ul>', 'dropdown',
{ nearElement: [dropdown_button, function (x, y, w, h) {
return [x, y + h + 4]
}],
binder: [dropdown_button, 'click']
}
);
Concatenate (Join) all the scopes with an underscore "_" between each scope in its lower case.
This:
ANIMATION: {
IN {
box: 'zap-in'
}
}
Becomes:
animation_in_box: 'zap-in'
This:
success: {
STYLE: {
CLASS: {
box: 'green-box'
},
INLINE: {
box: 'width:100%; padding:25px;'
}
},
POSITION: {
y: 'top'
}
}
Can be rewritten as:
success: {
style_class_box: 'green-box',
style_inline_box: 'width:100%; padding:25px;',
position_y: 'top'
}
Since incomplete scope-less property names are permitted, it can also be rewritten as:
success: {
STYLE: {
class_box: 'green-box',
INLINE: {
box: 'width:100%; padding:25px;'
}
}
position_y: 'top'
}
This:
PS.pop(
"general",
"Hello World",
{
POSITION: {
x: "25%"
}
}
});
Would become this:
pop( "Hello World", { position_x: "25%" } );
Here is the example:
PS.pop("general",
"
<div>
<p>Your password has been successfully reseted.</p>
<button class='popscript-out'>Close this dialog</button>
</div>
" );
Here is an example where we have a header to drag the pop around, just as seen in (every living and dead) Operating System dialog box:
PS.pop(
"general",
'<div class="popscript-drag" style="padding:20px;background-color: gainsboro">
Draggable Header
</div>
<p style="height:150px">
Lorem Ipsum
</p>',
{
full_draggable: 'no',
style_inline_box: 'padding:0'
}
)