Modal
Modal
Pattern Library modals have been designed to contain a fixed-position header. This means the modal header will always be in view as the modal content is scrolled down. The header includes an optional title and a close button, as seen in the example below.
Code
<!-- Scripts -->
<script src="jquery-2.2.4.min.js"></script>
<script src="jquery.modal.js"></script>
<!-- Create a link that points to the modal’s id. rel="modal:open" is required to open the modal -->
<a href="#modalId" rel="modal:open">Open Modal</a>
<!-- Modal HTML, embed this directly into the document, it will be hidden until the modal is opened -->
<div id="modalId" class="cui modal-window" >
<div class="modal-window-header">
<h2 class="modal-window-title">Modal window title</h2>
<a class="btn-modal-close cui btn-md primary-text" rel="modal:close">Close</a>
</div>
<div class="modal-window-body">
<!-- Enter modal content here -->
</div>
</div>
An optional call-to-action button may be placed beneath the modal title inside the fixed header, as seen in the example below.
Code
<!-- Scripts -->
<script src="jquery-2.2.4.min.js"></script>
<script src="jquery.modal.js"></script>
<!-- Create a link that points to the modal’s id. rel="modal:open" is required to open the modal -->
<a href="#modalId" rel="modal:open">Open Modal</a>
<!-- Modal HTML, embed this directly into the document, it will be hidden until the modal is opened -->
<div id="modalId" class="cui modal-window" >
<div class="modal-window-header">
<div class="header-content">
<h2 class="modal-window-title">Modal window title</h2>
<button class="cui btn-sm primary">Optional button</button>
</div>
<a class="btn-modal-close cui btn-md primary-text" rel="modal:close">Close</a>
</div>
<div class="modal-window-body">
<!-- Enter modal content here -->
</div>
</div>
The modal title is optional, as seen in the example below.
Code
<!-- Scripts -->
<script src="jquery-2.2.4.min.js"></script>
<script src="jquery.modal.js"></script>
<!-- Create a link that points to the modal’s id. rel="modal:open" is required to open the modal -->
<a href="#modalId" rel="modal:open">Open Modal</a>
<!-- Modal HTML, embed this directly into the document, it will be hidden until the modal is opened -->
<div id="modalId" class="cui modal-window" >
<div class="modal-window-header">
<a class="btn-modal-close cui btn-md primary-text" rel="modal:close">Close</a>
</div>
<div class="modal-window-body">
<!-- Enter modal content here -->
</div>
</div>
Modals are able to contain any length of content. See the example below for a modal with many lines of content.
Modal window title
CloseModal content. Etiam mi mauris, commodo ac orci sit amet, lacinia mattis lorem. Integer porttitor elementum dolor, sed molestie purus accumsan in. Etiam efficitur congue ex, ut varius lorem efficitur fermentum. Vestibulum non elit dapibus dui lobortis rutrum vitae at ipsum. Nam gravida, magna quis mattis blandit, nunc orci lobortis justo, vitae laoreet sapien diam sed nisi.
Modal window title
Modal content. Etiam mi mauris, commodo ac orci sit amet, lacinia mattis lorem. Integer porttitor elementum dolor, sed molestie purus accumsan in. Etiam efficitur congue ex, ut varius lorem efficitur fermentum. Vestibulum non elit dapibus dui lobortis rutrum vitae at ipsum. Nam gravida, magna quis mattis blandit, nunc orci lobortis justo, vitae laoreet sapien diam sed nisi.
Modal content. Etiam mi mauris, commodo ac orci sit amet, lacinia mattis lorem. Integer porttitor elementum dolor, sed molestie purus accumsan in. Etiam efficitur congue ex, ut varius lorem efficitur fermentum. Vestibulum non elit dapibus dui lobortis rutrum vitae at ipsum. Nam gravida, magna quis mattis blandit, nunc orci lobortis justo, vitae laoreet sapien diam sed nisi.
Modal window title
CloseModal content. Etiam mi mauris, commodo ac orci sit amet, lacinia mattis lorem. Integer porttitor elementum dolor, sed molestie purus accumsan in. Etiam efficitur congue ex, ut varius lorem efficitur fermentum. Vestibulum non elit dapibus dui lobortis rutrum vitae at ipsum. Nam gravida, magna quis mattis blandit, nunc orci lobortis justo, vitae laoreet sapien diam sed nisi.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam a porta diam. Duis maximus cursus lorem tempor sagittis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nullam ut congue ipsum. Phasellus lacinia ipsum velit. Ut posuere lacinia risus eu iaculis.
Fusce sollicitudin nisi nec arcu pellentesque fringilla. Etiam quis odio non lorem posuere consectetur. Fusce iaculis maximus blandit. Ut facilisis urna eget ex scelerisque, sit amet iaculis sapien finibus. Aenean condimentum accumsan ipsum, sed elementum orci accumsan a. Ut faucibus lectus vitae tellus iaculis, id interdum justo lobortis. Fusce semper mollis velit, vitae sollicitudin nisl pharetra eget. Interdum et malesuada fames ac ante ipsum primis in faucibus. Maecenas ac ex metus. Ut at magna ac tortor efficitur tempus et ac velit. Maecenas quis convallis justo, nec tincidunt libero. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris at ante eu nisi cursus venenatis.
Sed vehicula libero non lectus tempus accumsan. Sed quis nunc tincidunt, fringilla dolor in, scelerisque ligula. Donec mi sem, auctor rutrum augue et, pellentesque ornare lectus. Aliquam viverra sodales orci, eleifend ullamcorper magna bibendum mollis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam ultrices dui nec ipsum aliquet volutpat. Sed pulvinar vel nunc viverra cursus.