02.06.2015 Views

Bootstrap Tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Bootstrap</strong> Modal Plugin<br />

CHAPTER<br />

35<br />

Amodel is a child window that is layered over its parent window. Typically, the purpose is to display<br />

content from a separate source that can have some interaction without leaving the parent window. Child windows<br />

can provide information, interaction, or more.<br />

If you want to include this plugin functionality individually, then you will need modal.js. Else, as mentioned in the<br />

chapter <strong>Bootstrap</strong> Plugins Overview, you can include bootstrap.js or the minified bootstrap.min.js.<br />

Usage<br />

You can toggle the modal plugin's hidden content:<br />

<br />

<br />

Via data attributes: Set attribute data-toggle="modal" on a controller element, like a button or link, along<br />

with a data-target="#identifier" or href="#identifier" to target a specific modal (with the id="identifier") to<br />

toggle.<br />

Via JavaScript: Using this technique you can call a modal with id="identifier" with a single line of JavaScript:<br />

$('#identifier').modal(options)<br />

EXAMPLE<br />

A static modal window example is as shown in the following example:<br />

Example of creating Modals with Twitter <strong>Bootstrap</strong><br />

<br />

<br />

Launch demo modal<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

&times;<br />

<br />

<br />

This Modal title<br />

TUTORIALS POINT<br />

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!