Bring Bootstrap's components to life—now with 6 custom CSS plugins that (ab)use checkboxes.
:checked
pseudo-classI created bootleg-*.css as demonstration of :checked
for a talk, seriously don't use it. Except if you're doing custom checkbox/radios. See GitHub repo.
Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.
A rendered modal with header, body, and set of actions in the footer.
One fine body…
<div class="modal hide fade"> <div class="modal-header"> <label role="button" class="close" for="closemodal">×</label> <h3>Modal header</h3> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <label role="button" class="close" for="closemodal">Close</label> <a href="#" class="btn btn-primary">Save changes</a> </div> </div>
Toggle a modal via :checked
by clicking the button below. It will slide down and fade in from the top of the page.
<-- Button to trigger modal --> <label for="modal1" role="button" class="btn">Launch demo modal</label> <input type="radio" id="modal1" name="modal" /> <-- Modal --> <div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <label role="button" class="close" for="closemodal">×</label> <h3 id="myModalLabel">Modal header</h3> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <label role="button" class="close" for="closemodal">Close</label> <button class="btn btn-primary">Save changes</button> </div> </div>
Activate a modal without writing JavaScript. Set for="modal1"
on a controller label preceded by a radio input.
<label for="modal1" role="button" class="btn">Launch modal</label>
Call a modal with id modal1
with a single line of JavaScript:
$('#modal1').prop("checked")
Add dropdown menus to nearly anything with this simple plugin, including the navbar, tabs, and pills.
Add data-toggle="dropdown"
to a link or button to toggle a dropdown.
<div class="dropdown"> <input type="radio" name="dropdowns" id="dropdown1"> <label for="dropdown1" class="dropdown-toggle">Dropdown <b class="caret"></b></label> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> ... </ul> </div>
Call the dropdowns via JavaScript:
$('.dropdown-toggle').prop("checked")
Add quick, dynamic tab functionality to transiton through panes of local content, even via dropdown menus.
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
You can activate individual tabs in several ways:
$('#myTab #profile').prop('checked'); // Select tab by name $('#myTab input:first-of-type').prop('checked'); // Select first tab $('#myTab input:last-of-type').prop('checked'); // Select last tab
Each "tab" contains an input and a label, they cannot be nested as it'll defeat the trick of using :checked
and CSS doesn't have a parent selector yet.
<input type="radio" id="home" name="tabs" checked /> <label for="home">Home</label> <input type="radio" id="profile" name="tabs" /> <label for="profile">Profile</label> <input type="radio" id="other" name="tabs" /> <label for="other">Other</label> <input type="radio" id="misc" name="tabs" /> <label for="misc">Misc</label>
Get base styles and flexible support for collapsible components like accordions and navigation.
* Requires the Transitions plugin to be included.
Using the collapse plugin, we built a simple accordion style widget:
<input type="radio" id="collapse1" name="accordion-group" checked> <label for="collapseAll" class="accordion-dismiss"></label> <div class="accordion-heading"> <label for="collapse1" class="accordion-toggle">Collapsible Group Item #1</label> </div> <div id="collapseOne" class="accordion-body collapse"> <div class="accordion-inner"> ... </div> </div>
To make one open by default set the checked
attribute on the radio input.
The slideshow below shows a generic plugin and component for cycling through elements like a carousel.
<div id="myCarousel" class="carousel slide"> <!-- Carousel radios, add checked attribute to set initial active slide --> <input type="radio" id="slide1" name="slider" checked> <input type="radio" id="slide2" name="slider"> <input type="radio" id="slide3" name="slider"> <!-- Carousel items --> <div class="carousel-inner"> <div class="item">…</div> <div class="item">…</div> <div class="item">…</div> </div> <!-- Carousel nav --> <div id="controls"> <label for="slide1" class="carousel-control"><span>‹</span><span>›</span></label> <label for="slide2" class="carousel-control"><span>‹</span><span>›</span></label> <label for="slide3" class="carousel-control"><span>‹</span><span>›</span></label> </div> </div>