API & Options
Options
Option | Default value | Description |
---|---|---|
autoOpen |
true |
If true then the overlay gets automatically opened
after it is initialized. If false you have to open the
overlay on your own. |
background |
#000 (black) |
Background color/class of overlay. Predefined classes are lines-light and lines-dark. You can define your own class and set it as string. This feature was addded to allow images as background. |
closeOnClick |
true |
If true then the overlay gets closed when the user
clicks on it. |
destroyOnClose |
true |
If true then the overlay gets completely destroyed
after it is closed. So there no overlay element in the DOM any more. |
fadeInDuration |
250 |
Duration to fade to given opacity. |
fadeOutDuration |
250 |
Duration to fade out. |
opacity |
0.3 |
Opacity of the visible overlay. |
transitionDuration |
200 |
Duration for a transition (change background color/class or opacity). |
zIndex |
1000 |
z-index (CSS) value of the overlay. |
Events
Event | Description |
---|---|
onAfterClose |
This event is triggered after the overlay is completely closed which means that it is hidden (after the fading effect). |
onAfterOpen |
This event is triggered after the the overlay is completely visible. |
onBeforeClose |
This event is triggered before the overlay is
attempted to be closed. If the callback method returns false
the overlay does not get closed. |
onBeforeOpen |
This event is triggered before the overlay is visible. |
onCreate |
This event is triggered after the overlay instance has been created. |
onDestroy |
This event is triggered before the overlay instance is going to be destroyed. |
onHighlight |
This event is triggered after overlay was highlighted. If there are multiple highlights only one event is triggered. |
onInit |
This event is triggered after overlay instance is initialized. |
Methods
Method | Description |
---|---|
.apOverlay('destroy') |
Remove the overlay and its functionality completely. This will return the div-element back to its pre-init state. |
.apOverlay('option', optionName, [value]) |
Get or set any overlay option. If no value is specified, will act as a getter. |
.apOverlay('option', options) |
Set multiple overlay options at once by providing an options object. |
.apOverlay('widget') |
Returns the .ap-overlay div-element. |
.apOverlay('close') |
Hide overlay and destroy it when option destroyOnClose is true . |
.apOverlay('highlight', [color], [duration], [count]) |
Highlights overlay with the given color. Default color is
#ffff99 and default duration is 'normal' .
Furthermore you can specify how often the overlay should be highlighted
– default is one time. |
.apOverlay('isOpen') |
Returns true if the overlay is visible else false . |
.apOverlay('open') |
Open the overlay. |