02.06.2015 Views

Bootstrap Tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<br />

<br />

Add some text here<br />

<br />

<br />

Close<br />

<br />

<br />

Submit changes<br />

<br />

<br />

<br />

<br />

Details of the preceding code:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

To invoke the modal window, you need to have some kind of a trigger. You can use a button or a link. Here we<br />

have used button.<br />

If you look in the code above, you will see that in the tag, the data-target="#myModal"is the target<br />

of the modal that you want to load on the page. This code allows you to create multiple modals on the page<br />

and then have different triggers for each of them. Now, to be clear, you don’t load multiple modals at the same<br />

time, but you can create many on the page to be loaded at different times.<br />

There are two classes to take note of in the modal:<br />

o The first is .modal, which is simply identifying the content of the as a modal.<br />

o And second is the .fade class. When the modal is toggled, it will cause the content to fade in and out.<br />

aria-labelledby="myModalLabel", attribute reference the modal title.<br />

The attribute aria-hidden="true" is used to keep the Modal Window invisible till a trigger comes (like a click<br />

on the associated button).<br />

, modal-header is the class to define style for the header of the modal window.<br />

class="close", is a CSS class close that sets style for the Close button of the modal window.<br />

data-dismiss="modal", is a custom HTML5 data attribute. Here it is used to close the modal window.<br />

class="modal-body", is a CSS class of <strong>Bootstrap</strong> CSS to set style for body of the modal window.<br />

class="modal-footer", is a CSS class of <strong>Bootstrap</strong> CSS to set style for footer of the modal window.<br />

data-toggle="modal", HTML5 custom data attribute data-toggle is used to open the modal window.<br />

Options<br />

There are certain options which can be passed via data attributes or JavaScript to customize the look and feel of<br />

the Modal Window. Following table lists the options:<br />

TUTORIALS POINT<br />

Simply Easy Learning

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

Saved successfully!

Ooh no, something went wrong!