Bootstrap for ASP.NET MVC
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Using <strong>Bootstrap</strong> JavaScript Plugins<br />
In order to use <strong>Bootstrap</strong> plugins, we'll need to include the<br />
bootstrap.js or bootstrap.min.js ile in our project. This<br />
ile contains all the <strong>Bootstrap</strong> plugins, but if you do not intend to<br />
use every plugin in your project, it is a good idea to customize<br />
which components are to be included in the bootstrap.js<br />
ile. This will make the size of the <strong>Bootstrap</strong> library smaller<br />
and allow the website to load faster. To access these plugins,<br />
navigate to http://getbootstrap.com/customize/ and<br />
select the plugins that you'll be using in your project.<br />
Data attributes versus the<br />
programmatic API<br />
<strong>Bootstrap</strong> offers the ability to use its plugins entirely through the HTML markup.<br />
This means that in order to use most of the plugins, you do not need to write a<br />
single line of JavaScript. Using data attributes is the recommended approach<br />
and should be your irst option when using <strong>Bootstrap</strong> plugins.<br />
For example, to allow an alert element to be dismissible, you'll add the<br />
data-dismiss="alert" attribute to either a button or anchor element,<br />
as illustrated in the following code:<br />
<br />
×<br />
Warning Shuttle launch in t-minus 10 seconds.<br />
<br />
You also have the option to per<strong>for</strong>m the same action using the programmatic API via<br />
JavaScript. The following code uses jQuery to close a speciic alert element when<br />
the user clicks on a button:<br />
×<br />
[ 76 ]