You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
553 lines
15 KiB
553 lines
15 KiB
---
|
|
layout : 'default'
|
|
css : 'modal-demo'
|
|
|
|
title : 'Modal'
|
|
description : 'A modal displays content that temporarily blocks interactions with a web site'
|
|
type : 'UI Module'
|
|
---
|
|
<script src="/javascript/modal.js"></script>
|
|
|
|
<%- @partial('header', { tabs: 'module' }) %>
|
|
|
|
<div class="main container">
|
|
|
|
<div class="ui basic modal">
|
|
<div class="header">
|
|
Change Your Homepage
|
|
</div>
|
|
<div class="content">
|
|
<div class="left">
|
|
<i class="home icon"></i>
|
|
</div>
|
|
<div class="right">
|
|
<p>Are you sure you want to change your homepage to <b>Poodle.com</b>?</p>
|
|
</div>
|
|
</div>
|
|
<div class="actions">
|
|
<div class="two fluid ui buttons">
|
|
<div class="ui negative labeled icon button">
|
|
<i class="remove icon"></i>
|
|
No
|
|
</div>
|
|
<div class="ui positive right labeled icon button">
|
|
Yes
|
|
<i class="checkmark icon"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui small modal">
|
|
<i class="close icon"></i>
|
|
<div class="header">
|
|
Changing Your Thing
|
|
</div>
|
|
<div class="content">
|
|
<p>Do you want to change that thing to something else?</p>
|
|
</div>
|
|
<div class="actions">
|
|
<div class="ui negative button">
|
|
No
|
|
</div>
|
|
<div class="ui positive right labeled icon button">
|
|
Yes
|
|
<i class="checkmark icon"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui large modal">
|
|
<i class="close icon"></i>
|
|
<div class="header">
|
|
Changing Your Thing
|
|
</div>
|
|
<div class="content">
|
|
<p>Do you want to change that thing to something else?</p>
|
|
</div>
|
|
<div class="actions">
|
|
<div class="ui negative button">
|
|
No
|
|
</div>
|
|
<div class="ui positive right labeled icon button">
|
|
Yes
|
|
<i class="checkmark icon"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui test modal">
|
|
<i class="close icon"></i>
|
|
<div class="header">
|
|
Profile Picture
|
|
</div>
|
|
<div class="content">
|
|
<div class="left">
|
|
<img class="ui medium image" src="/images/demo/avatar2.jpg">
|
|
</div>
|
|
<div class="right">
|
|
<div class="ui header">Are you sure you want to upload that?</div>
|
|
<p>I mean it's not really the best profile photo.</p>
|
|
<p>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.</p>
|
|
</div>
|
|
</div>
|
|
<div class="actions">
|
|
<div class="ui black button">
|
|
Cancel
|
|
</div>
|
|
<div class="ui positive right labeled icon button">
|
|
Add Photo
|
|
<i class="checkmark icon"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui active tab" data-tab="definition">
|
|
|
|
<div class="peek">
|
|
<div class="ui vertical pointing secondary menu">
|
|
<a class="item">Types</a>
|
|
<a class="item">Variations</a>
|
|
<a class="item">States</a>
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="ui dividing header">Types</h2>
|
|
|
|
<div class="no example">
|
|
<h4 class="ui header">Standard</h4>
|
|
<p>A standard modal</p>
|
|
<div class="code" data-demo="true">
|
|
$('.test.modal')
|
|
.modal('show')
|
|
;
|
|
</div>
|
|
</div>
|
|
|
|
<div class="no example">
|
|
<h4 class="ui header">Basic</h4>
|
|
<p>A modal can reduce its complexity</p>
|
|
<div class="code" data-demo="true">
|
|
$('.basic.modal')
|
|
.modal('show')
|
|
;
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="ui dividing header">Variations</h2>
|
|
|
|
<div class="no example">
|
|
<h4 class="ui header">Size</h4>
|
|
<p>A modal can vary in size</p>
|
|
<div class="code" data-demo="true">
|
|
$('.small.modal')
|
|
.modal('show')
|
|
;
|
|
</div>
|
|
<div class="code" data-demo="true">
|
|
$('.large.modal')
|
|
.modal('show')
|
|
;
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="ui dividing header">States</h2>
|
|
|
|
<div class="example">
|
|
<h4 class="ui header">Active</h4>
|
|
<p>An active modal is visible on the page</p>
|
|
<div class="code" data-type="html">
|
|
<div class="active ui modal">...</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui tab" data-tab="examples">
|
|
|
|
<h2 class="ui dividing header">Examples</h2>
|
|
|
|
<div class="no example">
|
|
<h4 class="ui header">Forcing a Choice</h4>
|
|
<p>You can disable a modal's dimmer from being closed by click to force a user to make a choice</p>
|
|
<div class="code" data-demo="true">
|
|
$('.basic.modal')
|
|
.modal('setting', 'closable', false)
|
|
.modal('show')
|
|
;
|
|
</div>
|
|
</div>
|
|
|
|
<div class="no example">
|
|
<h4 class="ui header">Approve / Deny Callbacks</h4>
|
|
<p>Modals will automatically tie approve deny callbacks to any positive/approve, negative/deny or ok/cancel buttons. If a callback returns false it will prevent the modal from closing</p>
|
|
<div class="code" data-demo="true">
|
|
$('.basic.modal')
|
|
.modal('setting', {
|
|
closable : false,
|
|
onDeny : function(){
|
|
window.alert('Wait not yet!');
|
|
return false;
|
|
},
|
|
onApprove : function() {
|
|
window.alert('Approved!');
|
|
}
|
|
})
|
|
.modal('show')
|
|
;
|
|
</div>
|
|
</div>
|
|
|
|
<div class="no example">
|
|
<h4 class="ui header">Transitions</h4>
|
|
<p>A modal can use any named ui transition.</p>
|
|
<div class="ui selection dropdown">
|
|
<input type="hidden" name="transition">
|
|
<div class="default text">Choose transition</div>
|
|
<i class="dropdown icon"></i>
|
|
<div class="menu">
|
|
<div class="item">Horizontal Flip</div>
|
|
<div class="item">Vertical Flip</div>
|
|
<div class="item">Fade Up</div>
|
|
<div class="item">Fade</div>
|
|
<div class="item">Scale</div>
|
|
</div>
|
|
</div>
|
|
<div class="ui clearing divider"></div>
|
|
<div class="code">
|
|
$('.selection')
|
|
.dropdown({
|
|
onChange: function(value) {
|
|
$('.test.modal')
|
|
.modal('setting', 'transition', value)
|
|
.modal('show')
|
|
;
|
|
}
|
|
})
|
|
;
|
|
</div>
|
|
</div>
|
|
|
|
<div class="no example">
|
|
<h4 class="ui header">Attach events</h4>
|
|
<p>A modal can attach events to another element</p>
|
|
<div class="code" data-demo="true">
|
|
$('.test.modal')
|
|
.modal('attach events', '.test.button', 'show')
|
|
;
|
|
</div>
|
|
<div class="ui primary test button">Launch modal</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui tab" data-tab="usage">
|
|
|
|
<h2 class="ui dividing header">Usage</h2>
|
|
|
|
<h3 class="ui header">Initializing a modal</h3>
|
|
<p>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.</p>
|
|
<div class="ui info message">
|
|
<div class="header">Why move modal content?</div>
|
|
<p>Having a modal inside the page dimmer allows for 3D animations without having the 3D perspective settings alter the rest of the page content. Additionally, content outside the dimmer can be blurred or altered without affecting the modal's content.</p>
|
|
<p>If you need to have your modal stay in its current location you can preserve its position using the setting <code>detachable: false</code></p>
|
|
</div>
|
|
<div class="code" data-type="javascript">
|
|
$('.ui.modal')
|
|
.modal()
|
|
;
|
|
</div>
|
|
<div class="code" data-type="html">
|
|
<div class="ui modal">
|
|
<i class="close icon"></i>
|
|
<div class="header">
|
|
Modal Title
|
|
</div>
|
|
<div class="content">
|
|
<div class="left">
|
|
Content can appear on left
|
|
</div>
|
|
<div class="right">
|
|
Content can appear on right
|
|
</div>
|
|
</div>
|
|
<div class="actions">
|
|
<div class="ui button">Cancel</div>
|
|
<div class="ui button">OK</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="ui dividing header">Behavior</h2>
|
|
|
|
<p>All the following <a href="/module.html#/behavior">behaviors</a> can be called using the syntax:</p>
|
|
<div class="code">
|
|
$('.ui.modal')
|
|
.modal('behavior name', argumentOne, argumentTwo)
|
|
;
|
|
</div>
|
|
|
|
<table class="ui definition celled sortable table segment">
|
|
<thead>
|
|
<tr>
|
|
<th>Behavior</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>show</td>
|
|
<td>Shows the modal</td>
|
|
</tr>
|
|
<tr>
|
|
<td>hide</td>
|
|
<td>Hides the modal</td>
|
|
</tr>
|
|
<tr>
|
|
<td>toggle</td>
|
|
<td>Toggles the modal</td>
|
|
</tr>
|
|
<tr>
|
|
<td>refresh</td>
|
|
<td>Refreshes centering of modal on page</td>
|
|
</tr>
|
|
<tr>
|
|
<td>show dimmer</td>
|
|
<td>Shows associated page dimmer</td>
|
|
</tr>
|
|
<tr>
|
|
<td>hide dimmer</td>
|
|
<td>Hides associated page dimmer</td>
|
|
</tr>
|
|
<tr>
|
|
<td>hide others</td>
|
|
<td>Hides all modals not selected modal in a dimmer</td>
|
|
</tr>
|
|
<tr>
|
|
<td>hide all</td>
|
|
<td>Hides all visible modals in the same dimmer</td>
|
|
</tr>
|
|
<tr>
|
|
<td>cache sizes</td>
|
|
<td>Caches current modal size</td>
|
|
</tr>
|
|
<tr>
|
|
<td>can fit</td>
|
|
<td>Returns whether the modal can fit on the page</td>
|
|
</tr>
|
|
<tr>
|
|
<td>is active</td>
|
|
<td>Returns whether the modal is active</td>
|
|
</tr>
|
|
<tr>
|
|
<td>set active</td>
|
|
<td>Sets modal to active</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="ui tab" data-tab="settings">
|
|
|
|
<h2 class="ui dividing header">Settings</h2>
|
|
|
|
<h3 class="ui header">Modal Settings
|
|
<div class="sub header">Modal settings modify the modal's behavior</div>
|
|
</h3>
|
|
|
|
<table class="ui red celled sortable definition table segment">
|
|
<thead>
|
|
<tr>
|
|
<th>Setting</th>
|
|
<th class="four wide">Default</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>detachable</td>
|
|
<td>true</td>
|
|
<td>If set to false will prevent the modal from being moved to inside the dimmer</td>
|
|
</tr>
|
|
<tr>
|
|
<td>allowMultiple</td>
|
|
<td>false</td>
|
|
<td>If set to true will not close other visible modals when opening a new one</td>
|
|
</tr>
|
|
<tr>
|
|
<td>offset</td>
|
|
<td>0</td>
|
|
<td>A vertical offset to allow for content outside of modal, for example a close button, to be centered.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>context</td>
|
|
<td>
|
|
body
|
|
</td>
|
|
<td>Selector or jquery object specifying the area to dim</td>
|
|
</tr>
|
|
<tr>
|
|
<td>closable</td>
|
|
<td>
|
|
true
|
|
</td>
|
|
<td>Settings to false will not allow you to close the modal by clicking on the dimmer</td>
|
|
</tr>
|
|
<tr>
|
|
<td>useCSS</td>
|
|
<td>
|
|
true
|
|
</td>
|
|
<td>Whether to use CSS animations instead of fallback javascript animations</td>
|
|
</tr>
|
|
<tr>
|
|
<td>transition</td>
|
|
<td>
|
|
scale
|
|
</td>
|
|
<td>Named transition to use when animating menu in and out. <code>Fade</code> is available without including <a href="/modules/transition.html">ui transitions</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td>duration</td>
|
|
<td>
|
|
400
|
|
</td>
|
|
<td>Duration of animation</td>
|
|
</tr>
|
|
<tr>
|
|
<td>easing</td>
|
|
<td>
|
|
easeOutExpo
|
|
</td>
|
|
<td>Animation easing is only used if javascript animations are used.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="ui horizontal section icon divider"><i class="icon setting"></i></div>
|
|
<h3 class="ui header">Callbacks
|
|
<div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
|
|
</h3>
|
|
|
|
|
|
<table class="ui celled sortable definition table segment">
|
|
<thead>
|
|
<tr>
|
|
<th class="four wide">Setting</th>
|
|
<th>Context</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>onShow</td>
|
|
<td>Modal</td>
|
|
<td>Is called after a modal is shown.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>onHide</td>
|
|
<td>Modal</td>
|
|
<td>Is called after a modal is hidden.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>onApprove</td>
|
|
<td>Modal</td>
|
|
<td>Is called after a positive, approve or ok button is pressed</td>
|
|
</tr>
|
|
<tr>
|
|
<td>onDeny</td>
|
|
<td>Modal</td>
|
|
<td>Is called after a negative, deny or cancel button is pressed.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<h3 class="ui header">DOM Settings
|
|
<div class="sub header">DOM settings specify how this module should interface with the DOM</div>
|
|
</h3>
|
|
|
|
<table class="ui celled sortable definition table segment">
|
|
<thead>
|
|
<tr>
|
|
<th>Setting</th>
|
|
<th class="four wide">Default</th>
|
|
<th>Description</th>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>namespace</td>
|
|
<td>modal</td>
|
|
<td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>selector</td>
|
|
<td colspan="2">
|
|
<div class="code">
|
|
selector : {
|
|
close : '.close, .actions .button',
|
|
approve : '.actions .positive, .actions .approve, .actions .ok',
|
|
deny : '.actions .negative, .actions .deny, .actions .cancel'
|
|
},
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>className</td>
|
|
<td colspan="2">
|
|
<div class="code">
|
|
className : {
|
|
active : 'active',
|
|
scrolling : 'scrolling'
|
|
}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<h3 class="ui header">Debug Settings
|
|
<div class="sub header">Debug settings controls debug output to the console</div>
|
|
</h3>
|
|
|
|
<table class="ui celled sortable definition table segment">
|
|
<thead>
|
|
<tr>
|
|
<th>Setting</th>
|
|
<th class="four wide">Default</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>name</td>
|
|
<td>Modal</td>
|
|
<td>Name used in debug logs</td>
|
|
</tr>
|
|
<tr>
|
|
<td>debug</td>
|
|
<td>True</td>
|
|
<td>Provides standard debug output to console</td>
|
|
</tr>
|
|
<tr>
|
|
<td>performance</td>
|
|
<td>True</td>
|
|
<td>Provides standard debug output to console</td>
|
|
</tr>
|
|
<tr>
|
|
<td>verbose</td>
|
|
<td>True</td>
|
|
<td>Provides ancillary debug output to console</td>
|
|
</tr>
|
|
<tr>
|
|
<td>error</td>
|
|
<td colspan="2">
|
|
<div class="code">
|
|
error : {
|
|
method : 'The method you called is not defined.''
|
|
}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|