Andrey Konstantinov 8927029f2d renamed to match gh-pages requirements | 5 jaren geleden | |
---|---|---|
.. | ||
google-code-prettify | 5 jaren geleden | |
holder | 5 jaren geleden | |
README.md | 5 jaren geleden | |
application.js | 5 jaren geleden | |
bootstrap-affix.js | 5 jaren geleden | |
bootstrap-alert.js | 5 jaren geleden | |
bootstrap-button.js | 5 jaren geleden | |
bootstrap-carousel.js | 5 jaren geleden | |
bootstrap-collapse.js | 5 jaren geleden | |
bootstrap-dropdown.js | 5 jaren geleden | |
bootstrap-modal.js | 5 jaren geleden | |
bootstrap-popover.js | 5 jaren geleden | |
bootstrap-scrollspy.js | 5 jaren geleden | |
bootstrap-tab.js | 5 jaren geleden | |
bootstrap-tooltip.js | 5 jaren geleden | |
bootstrap-transition.js | 5 jaren geleden | |
bootstrap-typeahead.js | 5 jaren geleden | |
bootstrap.js | 5 jaren geleden | |
bootstrap.min.js | 5 jaren geleden | |
html5shiv.js | 5 jaren geleden | |
jquery.js | 5 jaren geleden |
These are the high-level design rules which guide the development of Bootstrap's plugin apis.
We believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of javascript.
We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with 'data-api'
. This looks like this:
$('body').off('.data-api')
To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:
$('body').off('.alert.data-api')
We also believe you should be able to use all plugins provided by Bootstrap purely through the JS API.
All public APIs should be single, chainable methods, and return the collection acted upon.
$(".btn.danger").button("toggle").addClass("fat")
All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:
$("#myModal").modal() // initialized with defaults
$("#myModal").modal({ keyboard: false }) // initialized with now keyboard
$("#myModal").modal('show') // initializes and invokes show immediately afterqwe2
Options should be sparse and add universal value. We should pick the right defaults.
All plugins should have a default object which can be modified to effect all instance's default options. The defaults object should be available via $.fn.plugin.defaults
.
$.fn.modal.defaults = { … }
An options definition should take the following form:
*noun*: *adjective* - describes or modifies a quality of an instance
examples:
backdrop: true
keyboard: false
placement: 'top'
All events should have an infinitive and past participle form. The infinitive is fired just before an action takes place, the past participle on completion of the action.
show | shown
hide | hidden
Each plugin should expose it's raw constructor on a Constructor
property -- accessed in the following way:
$.fn.popover.Constructor
Each plugin stores a copy of the invoked class on an object. This class instance can be accessed directly through jQuery's data API like this:
$('[rel=popover]').data('popover') instanceof $.fn.popover.Constructor
Data attributes should take the following form:
examples:
// control other targets
data-toggle="modal" data-target="#foo"
data-toggle="collapse" data-target="#foo" data-parent="#bar"
// defined on element they control
data-spy="scroll"
data-dismiss="modal"
data-dismiss="alert"
data-toggle="dropdown"
data-toggle="button"
data-toggle="buttons-checkbox"
data-toggle="buttons-radio"