Bring Bootstrap's components to life with new, custom plugins that work with MooTools.
Bootstrap, from Twitter is a heaping serving of awesomeness. In addition to it's easy to use grid system, layouts, good looking typography, and the fact that the whole thing is written in Less, it includes a handful of JavaScript plugins for jQuery and Ender to bring a lot of the CSS components to life. We're talking tips, popups, drop down menus and more.
For those of us who prefer MooTools, the JS included in Bootstrap isn't so useful. This library offers all the tools necessary to get the same functionality released by Twitter.
Included in this repo are numerous MooTools plugins that depend on MooTools Core, MooTools More, Clientcide, MooTools Behavior, and Behaviors for MooTools More. Building all these takes some configuration on your part (check out the MooTools Packager - here's a nice blog post on it by Ryan Florence), or you can just go to dev.clientcide.com and build it with the online tools there, which is what I recommend.
Our Modal plugin is a super slim take on the traditional modal js plugin, taking special care to include only the bare functionality that we require here at twitter.
<!-- this button will show the popup below it --> <button data-trigger="BS.showPopup" data-bs-showpopup-target="!body #demoPopup" class="btn btn-danger">Launch Modal</button> <div data-behavior="BS.Popup" class="modal fade" id="demoPopup"> <div class="modal-header"> <a href="#" class="close">×</a> <h3>Modal Heading</h3> </div> <div class="modal-body"> <p>One fine body...</p> </div> <div class="modal-footer"> <a href="#" class="btn btn-primary dismiss stopEvent">Primary</a> <a href="#" class="btn btn-secondary dismiss stopEvent">Secondary</a> </div> </div>
Name | type | default | description |
---|---|---|---|
persist | boolean | true | If false the popup and its modal layer will be destroyed when it is closed. Useful when you are fetching the popup with Ajax. |
hide | boolean | false | Do not show the Popup immediately. |
mask | boolean | true | Includes a modal-backdrop element. |
animate | boolean | true | Slides the window into and out of view with a smooth transition. |
closeOnClickOut | boolean | true | Close the popup when the user clicks out of it (on the mask or, if it's not used, the document body outside the popup). |
closeOnEsc | boolean | false | Closes the modal when escape key is pressed |
Notice
This implementation mirrors that found in Twitter's JS library. It uses CSS transitions when available (generally speaking, every browser but IE). Add the .fade
class to your element to have it transition in. You can alternately specify the animate
option in the behavior filter settings listed above. If you do not specify either of these, you should add the .hide
class unless you want your element visible immediately.
Notice
Any element in your content with the class .close
or .dismiss
will close the popup. The reason for both is that Bootstrap provides styles for .close elements (the *x* in the upper right corner) that you may not want applied to your element. By default, the default behavior for the click event on these elements is NOT stopped (so if they are submit buttons or actual links with href
properties, those actions will occur). Add the class stopEvent
to have the class call Event.preventDefault
for you.
Notice
Behavior options can be set inline (data-filtername-option="value"
) or using JSON-like values like so:
<div data-behavior="FilterName" data-filtername-options=" 'string': 'foo', 'number': 1, 'object': { 'array': [1,2]} ">...</div>
Notice
Selectors in Behavior filters and Delegator triggers are always relative to the element they modify. So if you want
to find an element that is a child of that element, you can just use a regular selector, but if you need to find
an element that is somewhere else in the DOM, use Slick's
reverse combinators (!.someParent #someChildOfThatParent
- e.g. !body #foo
).
One fine body...
This plugin is for adding dropdown interaction to the bootstrap topbar or tabbed navigations.
To quickly add dropdown functionality to any nav element, use the Dropdown
behavior. Any valid bootstrap dropdown inside the container will automatically be activated.
<-- a simple example --> <ul data-behavior="BS.Dropdown" class="nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Menu2</a> <ul class="dropdown-menu"> <li><a>item1</a></li> <li><a>item2</a></li> <li><a>item3</a></li> </ul> </li> </ul> <-- an example with numerous menus --> <div id="navbar-example" class="navbar navbar-static" data-behavior="BS.Dropdown"> <div class="navbar-inner"> <div class="container" style="width:auto"> <a href="#" class="brand">Project Name</a> <ul class="nav"> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 1 <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a>Secondary link</a></li> <li><a>Something else here</a></li> <li class="divider"></li> <li><a>Another link</a></li> </ul> </li> </ul> <ul class="nav pull-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a>Secondary link</a></li> <li><a>Something else here</a></li> <li class="divider"></li> <li><a>Another link</a></li> </ul> </li> </ul> </div> </div><!-- /navbar-inner --> </div><!-- /navbar-example -->
This plugin adds quick, dynamic tab and pill functionality.
You can activate a tab or pill navigation without writing any javascript by simply giving them a data-behavior="BS.Tabs"
.
<ul class="tabs" data-behavior="BS.Tabs" >...</ul>
Activates tab functionality for a given container.
<ul class="nav nav-tabs" data-behavior="BS.Tabs BS.Dropdown" data-bs-tabs-options=" 'smooth': true "> <li class="active"><a href="#home">Home</a></li> <li><a>Profile</a></li> <li><a>Messages</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Settings<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a>Email address</a></li> <li><a>Password</a></li> </ul> </li> </ul> <div id="my-tab-content" class="tab-content"> <div class="tab-pane active" id="home"> <p>...</p> </div> <div id="profile" class="tab-pane"> <p>...</p> </div> <div id="messages" class="tab-pane"> <p>...</p> </div> <div id="email" class="tab-pane"> <p>...</p> </div> <div id="password" class="tab-pane"> <p>...</p> </div> </div>
Name | type | default | description |
---|---|---|---|
tabs-selector | string | ">li" | A selector to find the tab elements that the user clicks. |
sections-selector | string | "+.tab-content > div" | A selector to find the sections that correlate to each tab. |
smooth | boolean | false | Fade in the content when the tabs are switched. |
smoothSize | boolean | false | Transition the height of each tab section as its displayed. |
selectedClass | string | "active" | The class added to the active tab. |
hash | string | -- | If defined, will add a hash value to the window location so that if the user reloads the selected tab will be selected by default. |
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.
Banksy do proident, brooklyn photo booth delectus sunt artisan sed organic exercitation eiusmod four loko. Quis tattooed iphone esse aliqua. Master cleanse vero fixie mcsweeney's. Ethical portland aute, irony food truck pitchfork lomo eu anim. Aesthetic blog DIY, ethical beard leggings tofu consequat whatever cardigan nostrud. Helvetica you probably haven't heard of them carles, marfa veniam occaecat lomo before they sold out in shoreditch scenester sustainable thundercats. Consectetur tofu craft beer, mollit brunch fap echo park pitchfork mustache dolor.
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.
Aliqua tofu quinoa +1 commodo eiusmod. High life williamsburg cupidatat twee homo leggings. Four loko vinyl DIY consectetur nisi, marfa retro keffiyeh vegan. Fanny pack viral retro consectetur gentrify fap.
Based on the excellent jQuery.tipsy plugin written by Jason Frame; Bootstrap.Tooltip is an updated version, which doesn't rely on images, uses css3 for animations, and is based on MooTools.
<a data-behavior="BS.Tooltip" title="I'm a tooltip">a tip!</a>
Name | type | default | description |
---|---|---|---|
content | string | 'title' | the content of the tip, if not defined, will use the title property of the element |
animate | boolean | true | apply a css fade transition to the tooltip |
delayIn | number | 200 | delay before showing tooltip (ms) |
delayOut | number | 0 | delay before hiding tooltip (ms) |
placement | string | 'above' | how to position the tooltip - above | below | left | right |
offset | number | 0 | pixel offset of tooltip from target element |
trigger | string | 'hover' | how tooltip is triggered - hover | focus | manual |
onOverflow | boolean | false | Only show the tip if the element's content is overflown (i.e. it's scroll-height or scroll-width is greater than the height or width of the element) |
Tight pants next level keffiyeh you probably haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel have a terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan whatever keytar, scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
The popover plugin provides a simple interface for adding popovers to your application.
<a data-behavior="BS.Popover" title="A Title" data-bs-popover-content="And here's some amazing content. It's very engaging. right?">hover for popover</a>
Name | type | default | description |
---|---|---|---|
title | string | -- | the title of the popover, if not defined, will use the title property of the element |
content | string | -- | the content of the popover |
animate | boolean | true | apply a css fade transition to the tooltip |
delayIn | number | 200 | delay before showing tooltip (ms) |
delayOut | number | 0 | delay before hiding tooltip (ms) |
placement | string | 'right' | how to position the tooltip - above | below | left | right |
offset | number | 10 | pixel offset of tooltip from target element |
trigger | string | 'hover' | how tooltip is triggered - hover | focus | manual |
onOverflow | boolean | false | Only show the tip if the element's content is overflown (i.e. it's scroll-height or scroll-width is greater than the height or width of the element) |
Adding close functionality to alerts with MooTools' Behavior is super easy.
Closing errors uses the nix
trigger from the Fx.Reveal
delegator in more-behaviors. You can put this trigger on any element.
<div class="alert alert-error"> <!-- the data trigger references the parent div.alert --> <a class="close" data-trigger="nix" data-nix-options=" 'target': '!div.alert' ">×</a> <p>Oh snap! You Got an error!</p> </div>
Holy guacamole! Best check yo self, you're not looking too good.
This implementation supports only the plugins that the author has had personal need of. I hope to add support for all the interactive features available in Bootstrap at some point. Pull requests are welcome!
For accordion support, use the Behavior.Accordion plugin in More Behaviors.
There is currently no support for the Carousel functionality found in Bootstrap.
There is currently no support for the Typeahead functionality found in Bootstrap.
There is currently no support for the Scrollspy functionality found in Bootstrap.