Are you sure you want to change your homepage to Poodle.com?
Do you want to change that thing to something else?
Do you want to change that thing to something else?
I mean it's not really the best profile photo.
It's resampled to like two times the size it's suppose to be. Our image detection software also says it might even be inappropriate.
Types
Standard
A standard modal
Basic
A modal can reduce its complexity
Variations
Size
A modal can vary in size
States
Active
An active modal is visible on the page
Examples
Approve / Deny Callbacks
Modals will automatically tie approve deny callbacks to any positive/approve or negative/deny buttons. If a callback returns false it will prevent the modal from closing
Forcing a Choice
You can disable a modal's dimmer from being closed by click to force a user to make a choice
Transitions
A modal can use any named ui transition.
Attach events
A modal can attach events to another element
Usage
Initializing a modal
A modal can be included anywhere on the page. On initialization a modal's current size will be cached, and the element will be detached from the dom and moved inside a dimmer.
Behavior
All the following behaviors can be called using the syntax:
Behavior | Description |
---|---|
show | Shows the modal |
hide | Hides the modal |
toggle | Toggles the modal |
refresh | Refreshes centering of modal on page |
show dimmer | Shows associated page dimmer |
hide dimmer | Hides associated page dimmer |
hide all | Hides all visible modals initialized at the same time |
cache sizes | Caches current modal size |
can fit | Returns whether the modal can fit on the page |
is active | Returns whether the modal is active |
set active | Sets modal to active |
Settings
Modal Settings
Modal settings modify the modal's behavior
Setting | Default | Description |
---|---|---|
offset | 0 | A vertical offset to allow for content outside of modal, for example a close button, to be centered. |
context | body | Selector or jquery object specifying the area to dim |
closable | true | Settings to false will not allow you to close the modal by clicking on the dimmer |
useCSS | true | Whether to use CSS animations instead of fallback javascript animations |
transition | scale | Named transition to use when animating menu in and out. Fade is available without including ui transitions |
duration | 400 | Duration of animation |
easing | easeOutExpo | Animation easing is only used if javascript animations are used. |
Callbacks
Callbacks specify a function to occur after a specific behavior.
Setting | Context | Description |
---|---|---|
onShow | Modal | Is called after a modal is shown. |
onHide | Modal | Is called after a modal is hidden. |
onApprove | Modal | Is called after a positive or approve button is pressed |
onDeny | Modal | Is called after a negative or cancel button is pressed. |
DOM Settings
DOM settings specify how this module should interface with the DOM
Setting | Default | Description |
---|---|---|
namespace | modal | Event namespace. Makes sure module teardown does not effect other events attached to an element. |
selector |
selector : {
close : '.close, .actions .button',
approve : '.actions .positive, .actions .approve',
deny : '.actions .negative, .actions .cancel'
},
|
|
className |
className : {
active : 'active',
scrolling : 'scrolling'
}
|
Debug Settings
Debug settings controls debug output to the console
Setting | Default | Description |
---|---|---|
name | Modal | Name used in debug logs |
debug | True | Provides standard debug output to console |
performance | True | Provides standard debug output to console |
verbose | True | Provides ancillary debug output to console |
error |
error : {
method : 'The method you called is not defined.''
}
|