javascript.mustache 70.67 KiB
      <!-- Masthead
      ================================================== -->
      <header class="jumbotron subhead" id="overview">
        <h1>{{_i}}Javascript for Bootstrap{{/i}}</h1>
        <p class="lead">{{_i}}Bring Bootstrap's components to life&mdash;now with 12 custom <a href="http://jquery.com/" target="_blank">jQuery</a> plugins.{{/i}}
        <div class="subnav">
          <ul class="nav nav-pills">
            <li><a href="#javascript">{{_i}}All plugins{{/i}}</a></li>
            <li><a href="#modals">{{_i}}Modal{{/i}}</a></li>
            <li><a href="#dropdowns">{{_i}}Dropdown{{/i}}</a></li>
            <li><a href="#scrollspy">{{_i}}Scrollspy{{/i}}</a></li>
            <li><a href="#tabs">{{_i}}Tab{{/i}}</a></li>
            <li><a href="#tooltips">{{_i}}Tooltip{{/i}}</a></li>
            <li><a href="#popovers">{{_i}}Popover{{/i}}</a></li>
            <li><a href="#alerts">{{_i}}Alert{{/i}}</a></li>
            <li><a href="#buttons">{{_i}}Button{{/i}}</a></li>
            <li><a href="#collapse">{{_i}}Collapse{{/i}}</a></li>
            <li><a href="#carousel">{{_i}}Carousel{{/i}}</a></li>
            <li><a href="#typeahead">{{_i}}Typeahead{{/i}}</a></li>
          </ul>
        </div>
      </header>
      <!-- Using Javascript w/ Bootstrap
      ================================================== -->
      <section id="javascript">
        <div class="page-header">
          <h1>{{_i}}jQuery plugins{{/i}} <small>{{_i}}A dozen Bootstrap plugins to get you started{{/i}}</small></h1>
        </div>
      <div class="row">
        <div class="span3">
          <label>
            <h3><a href="./javascript.html#modals">{{_i}}Modals{{/i}}</a></h3>
            <p>{{_i}}A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.{{/i}}</p>
          </label>
        </div>
        <div class="span3">
          <label>
            <h3><a href="./javascript.html#dropdowns">{{_i}}Dropdowns{{/i}}</a></h3>
            <p>{{_i}}Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.{{/i}}</p>
          </label>
        </div>
        <div class="span3">
          <label>
            <h3><a href="./javascript.html#scrollspy">{{_i}}Scrollspy{{/i}}</a></h3>
            <p>{{_i}}Use scrollspy to automatically update the links in your navbar to show the current active link based on scroll position.{{/i}}</p>
          </label>
        </div>
        <div class="span3">
          <label>
            <h3><a href="./javascript.html#tabs">{{_i}}Togglable tabs{{/i}}</a></h3>
            <p>{{_i}}Use this plugin to make tabs and pills more useful by allowing them to toggle through tabbable panes of local content.{{/i}}</p>
          </label>
        </div>
      </div> <!-- /row -->
      <div class="row">
        <div class="span3">
          <label>
            <h3><a href="./javascript.html#tooltips">{{_i}}Tooltips{{/i}}</a></h3>
            <p>{{_i}}A new take on the jQuery Tipsy plugin, Tooltips don't rely on images, uss CSS3 for animations, and data-attributes for local title storage.{{/i}}</p>
          </label>
        </div>
        <div class="span3">
          <label>
            <h3><a href="./javascript.html#popovers">{{_i}}Popovers{{/i}}</a> <small class="muted">*</small></h3>
            <p>{{_i}}Add small overlays of content, like those on the iPad, to any element for housing secondary information.{{/i}}</p>
            <p class="muted"><strong>*</strong> {{_i}}Requires <a href="#tooltips">Tooltips</a> to be included{{/i}}</p>
          </label>
        </div>
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
<div class="span3"> <label> <h3><a href="./javascript.html#alerts">{{_i}}Alert messages{{/i}}</a></h3> <p>{{_i}}The alert plugin is a tiny class for adding close functionality to alerts.{{/i}}</p> </label> </div> <div class="span3"> <label> <h3><a href="./javascript.html#buttons">{{_i}}Buttons{{/i}}</a></h3> <p>{{_i}}Do more with buttons. Control button states or create groups of buttons for more components like toolbars.{{/i}}</p> </label> </div> </div> <!-- /row --> <div class="row" style="margin-bottom: 9px;"> <div class="span3"> <label> <h3><a href="./javascript.html#collapse">{{_i}}Collapse{{/i}}</a></h3> <p>{{_i}}Get base styles and flexible support for collapsible components like accordions and navigation.{{/i}}</p> </label> </div> <div class="span3"> <label> <h3><a href="./javascript.html#carousel">{{_i}}Carousel{{/i}}</a></h3> <p>{{_i}}Create a merry-go-round of any content you wish to provide an interactive slideshow of content.{{/i}}</p> </label> </div> <div class="span3"> <label> <h3><a href="./javascript.html#typeahead">Typeahead</a></h3> <p>{{_i}}A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.{{/i}}</p> </label> </div> <div class="span3"> <label> <h3>{{_i}}Transitions{{/i}} <small class="muted">*</small></h3> <p>{{_i}}For simple transition effects, include bootstrap-transition.js once to slide in modals or fade out alerts.{{/i}}</p> <p class="muted"><strong>*</strong> {{_i}}Required for animation in plugins{{/i}}</p> </label> </div> </div> <!-- /row --> <div class="alert alert-info"><strong>{{_i}}Heads up!{{/i}}</strong> {{_i}}All javascript plugins require the latest version of jQuery.{{/i}}</div> </section> <!-- Modal ================================================== --> <section id="modals"> <div class="page-header"> <h1>{{_i}}Modals{{/i}} <small>bootstrap-modal.js</small></h1> </div> <div class="row"> <div class="span3 columns"> <h3>{{_i}}About modals{{/i}}</h3> <p>{{_i}}A streamlined, but flexible, take on the traditional javascript modal plugin with only the minimum required functionality and smart defaults.{{/i}}</p> <a href="assets/js/bootstrap-modal.js" target="_blank" class="btn">{{_i}}Download file{{/i}}</a> </div> <div class="span9 columns"> <h2>{{_i}}Static example{{/i}}</h2> <p>{{_i}}Below is a statically rendered modal.{{/i}}</p> <div class="well modal-example" style="background-color: #888; border: none;"> <div class="modal" style="position: relative; top: auto; left: auto; margin: 0 auto; z-index: 1"> <div class="modal-header"> <a href="#" class="close" data-dismiss="modal">&times;</a> <h3>{{_i}}Modal header{{/i}}</h3> </div> <div class="modal-body"> <p>{{_i}}One fine body…{{/i}}</p> </div> <div class="modal-footer">
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
<a href="#" class="btn btn-primary">{{_i}}Save changes{{/i}}</a> <a href="#" class="btn">{{_i}}Close{{/i}}</a> </div> </div> </div> <!-- /well --> <h2>{{_i}}Live demo{{/i}}</h2> <p>{{_i}}Toggle a modal via javascript by clicking the button below. It will slide down and fade in from the top of the page.{{/i}}</p> <!-- sample modal content --> <div id="myModal" class="modal hide fade"> <div class="modal-header"> <a class="close" data-dismiss="modal" >&times;</a> <h3>{{_i}}Modal Heading{{/i}}</h3> </div> <div class="modal-body"> <h4>{{_i}}Text in a modal{{/i}}</h4> <p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem.</p> <h4>{{_i}}Popover in a modal{{/i}}</h4> <p>{{_i}}This <a href="#" class="btn popover-test" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">button</a> should trigger a popover on hover.{{/i}}</p> <h4>{{_i}}Tooltips in a modal{{/i}}</h4> <p>{{_i}}<a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> should have tooltips on hover.{{/i}}</p> </div> <div class="modal-footer"> <a href="#" class="btn btn-primary">{{_i}}Save changes{{/i}}</a> <a href="#" class="btn" data-dismiss="modal" >{{_i}}Close{{/i}}</a> </div> </div> <a data-toggle="modal" href="#myModal" class="btn btn-primary btn-large">{{_i}}Launch demo modal{{/i}}</a> <hr> <h2>{{_i}}Using bootstrap-modal{{/i}}</h2> <p>{{_i}}Call the modal via javascript:{{/i}}</p> <pre class="prettyprint linenums">$('#myModal').modal(options)</pre> <h3>{{_i}}Options{{/i}}</h3> <table class="table table-bordered table-striped"> <thead> <tr> <th style="width: 100px;">{{_i}}Name{{/i}}</th> <th style="width: 50px;">{{_i}}type{{/i}}</th> <th style="width: 50px;">{{_i}}default{{/i}}</th> <th>{{_i}}description{{/i}}</th> </tr> </thead> <tbody> <tr> <td>{{_i}}backdrop{{/i}}</td> <td>{{_i}}boolean{{/i}}</td> <td>{{_i}}true{{/i}}</td> <td>{{_i}}Includes a modal-backdrop element{{/i}}</td> </tr> <tr> <td>{{_i}}keyboard{{/i}}</td> <td>{{_i}}boolean{{/i}}</td> <td>{{_i}}true{{/i}}</td> <td>{{_i}}Closes the modal when escape key is pressed{{/i}}</td> </tr> </tbody> </table> <h3>{{_i}}Markup{{/i}}</h3> <p>{{_i}}You can activate modals on your page easily without having to write a single line of javascript. Just set <code>data-toggle="modal"</code> on a controller element with a <code>data-target="#foo"</code> or <code>href="#foo"</code> which corresponds to a modal element id, and when clicked, it will launch your modal.</p> <p>Also, to add options to your modal instance, just include them as additional data attributes on either the control element or the modal markup itself.{{/i}}</p> <pre class="prettyprint linenums"> &lt;a class="btn" data-toggle="modal" href="#myModal" &gt;{{_i}}Launch Modal{{/i}}&lt;/a&gt; </pre> <pre class="prettyprint linenums"> &lt;div class="modal"&gt;
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
&lt;div class="modal-header"&gt; &lt;a class="close" data-dismiss="modal"&gt;&times;&lt;/a&gt; &lt;h3&gt;Modal header&lt;/h3&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;p&gt;{{_i}}One fine body…{{/i}}&lt;/p&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;a href="#" class="btn btn-primary"&gt;{{_i}}Save changes{{/i}}&lt;/a&gt; &lt;a href="#" class="btn"&gt;{{_i}}Close{{/i}}&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </pre> <div class="alert alert-info"> <strong>{{_i}}Heads up!{{/i}}</strong> {{_i}}If you want your modal to animate in and out, just add a <code>.fade</code> class to the <code>.modal</code> element (refer to the demo to see this in action) and include bootstrap-transition.js.{{/i}} </div> <h3{{_i}}>Methods{{/i}}</h3> <h4>.modal({{_i}}options{{/i}})</h4> <p>{{_i}}Activates your content as a modal. Accepts an optional options <code>object</code>.{{/i}}</p> <pre class="prettyprint linenums"> $('#myModal').modal({ keyboard: false })</pre> <h4>.modal('toggle')</h4> <p>{{_i}}Manually toggles a modal.{{/i}}</p> <pre class="prettyprint linenums">$('#myModal').modal('toggle')</pre> <h4>.modal('show')</h4> <p>{{_i}}Manually opens a modal.{{/i}}</p> <pre class="prettyprint linenums">$('#myModal').modal('show')</pre> <h4>.modal('hide')</h4> <p>{{_i}}Manually hides a modal.{{/i}}</p> <pre class="prettyprint linenums">$('#myModal').modal('hide')</pre> <h3>{{_i}}Events{{/i}}</h3> <p>{{_i}}Bootstrap's modal class exposes a few events for hooking into modal functionality.{{/i}}</p> <table class="table table-bordered table-striped"> <thead> <tr> <th style="width: 150px;">{{_i}}Event{{/i}}</th> <th>{{_i}}Description{{/i}}</th> </tr> </thead> <tbody> <tr> <td>{{_i}}show{{/i}}</td> <td>{{_i}}This event fires immediately when the <code>show</code> instance method is called.{{/i}}</td> </tr> <tr> <td>{{_i}}shown{{/i}}</td> <td>{{_i}}This event is fired when the modal has been made visible to the user (will wait for css transitions to complete).{{/i}}</td> </tr> <tr> <td>{{_i}}hide{{/i}}</td> <td>{{_i}}This event is fired immediately when the <code>hide</code> instance method has been called.{{/i}}</td> </tr> <tr> <td>{{_i}}hidden{{/i}}</td> <td>{{_i}}This event is fired when the modal has finished being hidden from the user (will wait for css transitions to complete).{{/i}}</td> </tr> </tbody> </table> <pre class="prettyprint linenums"> $('#myModal').on('hidden', function () { // {{_i}}do something…{{/i}} })</pre> </div> </div> </section>
281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
<!-- Dropdown ================================================== --> <section id="dropdowns"> <div class="page-header"> <h1>{{_i}}Dropdowns{{/i}} <small>bootstrap-dropdown.js</small></h1> </div> <div class="row"> <div class="span3 columns"> <h3>{{_i}}About dropdowns{{/i}}</h3> <p>{{_i}}Add dropdown menus to nearly anything in Bootstrap with this simple plugin. Bootstrap features full dropdown menu support on in the navbar, tabs, and pills.{{/i}}</p> <a href="assets/js/bootstrap-dropdown.js" target="_blank" class="btn">{{_i}}Download file{{/i}}</a> </div> <div class="span9 columns"> <h2>{{_i}}Examples{{/i}}</h2> <p>{{_i}}Click on the dropdown nav links in the navbar and pills below to test dropdowns.{{/i}}</p> <div id="navbar-example" class="navbar navbar-static"> <div class="navbar-inner"> <div class="container" style="width: auto;"> <a class="brand" href="#">{{_i}}Project Name{{/i}}</a> <ul class="nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{_i}}Dropdown{{/i}} <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">{{_i}}Action{{/i}}</a></li> <li><a href="#">{{_i}}Another action{{/i}}</a></li> <li><a href="#">{{_i}}Something else here{{/i}}</a></li> <li class="divider"></li> <li><a href="#">{{_i}}Separated link{{/i}}</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{_i}}Dropdown 2 {{/i}}<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">{{_i}}Action{{/i}}</a></li> <li><a href="#">{{_i}}Another action{{/i}}</a></li> <li><a href="#">{{_i}}Something else here{{/i}}</a></li> <li class="divider"></li> <li><a href="#">{{_i}}Separated link{{/i}}</a></li> </ul> </li> </ul> <ul class="nav pull-right"> <li id="fat-menu" class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{_i}}Dropdown 3{{/i}} <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">{{_i}}Action{{/i}}</a></li> <li><a href="#">{{_i}}Another action{{/i}}</a></li> <li><a href="#">{{_i}}Something else here{{/i}}</a></li> <li class="divider"></li> <li><a href="#">{{_i}}Separated link{{/i}}</a></li> </ul> </li> </ul> </div> </div> </div> <!-- /navbar-example --> <ul class="nav nav-pills"> <li class="active"><a href="#">{{_i}}Regular link{{/i}}</a></li> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{_i}}Dropdown{{/i}} <b class="caret"></b></a> <ul id="menu1" class="dropdown-menu"> <li><a href="#">{{_i}}Action{{/i}}</a></li> <li><a href="#">{{_i}}Another action{{/i}}</a></li> <li><a href="#">{{_i}}Something else here{{/i}}</a></li> <li class="divider"></li> <li><a href="#">{{_i}}Separated link{{/i}}</a></li> </ul> </li>