From: Mark Otto Date: Sun, 4 Jan 2015 04:08:58 +0000 (-0800) Subject: Merge branch 'master' into v4 X-Git-Tag: v4.0.0-alpha~426 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e5d17d5f651a7bd3ff7f245d75a2d9fd591c8ce;p=thirdparty%2Fbootstrap.git Merge branch 'master' into v4 Conflicts: Gruntfile.js dist/css/bootstrap-theme.css dist/css/bootstrap-theme.css.map dist/css/bootstrap-theme.min.css dist/css/bootstrap.css dist/css/bootstrap.css.map dist/css/bootstrap.min.css dist/js/bootstrap.min.js docs/_data/glyphicons.yml docs/_includes/components/alerts.html docs/_includes/components/badges.html docs/_includes/components/breadcrumbs.html docs/_includes/components/button-dropdowns.html docs/_includes/components/button-groups.html docs/_includes/components/dropdowns.html docs/_includes/components/glyphicons.html docs/_includes/components/input-groups.html docs/_includes/components/jumbotron.html docs/_includes/components/labels.html docs/_includes/components/list-group.html docs/_includes/components/media.html docs/_includes/components/navbar.html docs/_includes/components/navs.html docs/_includes/components/page-header.html docs/_includes/components/pagination.html docs/_includes/components/panels.html docs/_includes/components/progress-bars.html docs/_includes/components/responsive-embed.html docs/_includes/components/thumbnails.html docs/_includes/components/wells.html docs/_includes/css/buttons.html docs/_includes/css/code.html docs/_includes/css/forms.html docs/_includes/css/grid.html docs/_includes/css/helpers.html docs/_includes/css/images.html docs/_includes/css/less.html docs/_includes/css/tables.html docs/_includes/css/type.html docs/_includes/customizer-variables.html docs/_includes/getting-started/accessibility.html docs/_includes/getting-started/disabling-responsiveness.html docs/_includes/getting-started/download.html docs/_includes/getting-started/whats-included.html docs/_includes/js/alerts.html docs/_includes/js/buttons.html docs/_includes/js/carousel.html docs/_includes/js/collapse.html docs/_includes/js/modal.html docs/_includes/js/overview.html docs/_includes/js/popovers.html docs/_includes/js/tabs.html docs/_includes/js/tooltips.html docs/_includes/nav/components.html docs/_includes/nav/javascript.html docs/_jade/customizer-variables.jade docs/_layouts/default.html docs/about.html docs/assets/css/docs.min.css docs/assets/css/src/docs.css docs/assets/js/customize.min.js docs/assets/js/raw-files.min.js docs/assets/js/src/customizer.js docs/customize.html docs/dist/css/bootstrap-theme.css.map docs/dist/css/bootstrap.css docs/dist/css/bootstrap.css.map docs/dist/css/bootstrap.min.css less/glyphicons.less less/mixins/vendor-prefixes.less less/navbar.less less/popovers.less less/tables.less less/theme.less less/tooltip.less less/variables.less package.json scss/_carousel.scss scss/_close.scss scss/_forms.scss test-infra/npm-shrinkwrap.json --- 0e5d17d5f651a7bd3ff7f245d75a2d9fd591c8ce diff --cc docs/_includes/js/popovers.html index 4557a44a42,321c93d9bd..0000000000 deleted file mode 100644,100644 --- a/docs/_includes/js/popovers.html +++ /dev/null @@@ -1,303 -1,303 +1,0 @@@ --
--

Popovers popover.js

-- --

Add small overlays of content, like those on the iPad, to any element for housing secondary information.

--

Popovers whose both title and content are zero-length are never displayed.

-- --
--

Plugin dependency

--

Popovers require the tooltip plugin to be included in your version of Bootstrap.

--
--
--

Opt-in functionality

--

For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must initialize them yourself.

--

One way to initialize all popovers on a page would be to select them by their data-toggle attribute:

--{% highlight js %} --$(function () { -- $('[data-toggle="popover"]').popover() --}) --{% endhighlight %} --
--
--

Popovers in button groups and input groups require special setting

--

When using popovers on elements within a .btn-group or an .input-group, you'll have to specify the option container: 'body' (documented below) to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the popover is triggered).

--
--
--

Don't try to show popovers on hidden elements

--

Invoking $(...).popover('show') when the target element is display: none; will cause the popover to be incorrectly positioned.

--
--
--

Popovers on disabled elements require wrapper elements

--

To add a popover to a disabled or .disabled element, put the element inside of a <div> and apply the popover to that <div> instead.

--
--
--

Multiple-line links

--

Sometimes you want to add a popover to a hyperlink that wraps multiple lines. The default behavior of the popover plugin is to center it horizontally and vertically. Add white-space: nowrap; to your anchors to avoid this.

--
-- --

Examples

--

Static popover

--

Four options are available: top, right, bottom, and left aligned.

-
-
-
-
-
-
--

Popover top

--
--

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

--
--
-- -
-
-
-
--

Popover right

--
--

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

--
--
-- -
-
-
-
--

Popover bottom

-- --
--

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

--
--
-- -
-
-
-
--

Popover left

--
--

Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

--
--
-- --
--
-- --

Live demo

--
-- --
--{% highlight html %} -- --{% endhighlight %} -- --

Four directions

--
--
-- -- -- -- --
--
--{% highlight html %} -- -- -- -- -- -- -- --{% endhighlight %} -- --

Dismiss on next click

--

Use the focus trigger to dismiss popovers on the next click that the user makes.

--
--

Specific markup required for dismiss-on-next-click

--

For proper cross-browser and cross-platform behavior, you must use the <a> tag, not the <button> tag, and you also must include a tabindex attribute.

--
-- --{% highlight html %} --Dismissible popover --{% endhighlight %} -- -- --

Usage

--

Enable popovers via JavaScript:

-- {% highlight js %}$('#example').popover(options){% endhighlight %} -- --

Options

--

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-animation="".

--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
NameTypeDefaultDescription
animationbooleantrueApply a CSS fade transition to the popover
containerstring | falsefalse --

Appends the popover to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.

--
contentstring | function'' --

Default content value if data-content attribute isn't present.

--

If a function is given, it will be called with its this reference set to the element that the popover is attached to.

--
delaynumber | object0 --

Delay showing and hiding the popover (ms) - does not apply to manual trigger type

--

If a number is supplied, delay is applied to both hide/show

--

Object structure is: delay: { "show": 500, "hide": 100 }

--
htmlbooleanfalseInsert HTML into the popover. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.
placementstring | function'right' --

How to position the popover - top | bottom | left | right | auto.
When "auto" is specified, it will dynamically reorient the popover. For example, if placement is "auto left", the popover will display to the left when possible, otherwise it will display right.

--

When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the popover instance.

--
selectorstringfalseIf a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See this and an informative example.
templatestring'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>''<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' --

Base HTML to use when creating the popover.

--

The popover's title will be injected into the .popover-title.

--

The popover's content will be injected into the .popover-content.

-

.popover-arrow will become the popover's arrow.

-

.arrow will become the popover's arrow.

--

The outermost wrapper element should have the .popover class.

--
titlestring | function'' --

Default title value if title attribute isn't present.

--

If a function is given, it will be called with its this reference set to the element that the popover is attached to.

--
triggerstring'click'How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
viewportstring | object{ selector: 'body', padding: 0 } --

Keeps the popover within the bounds of this element. Example: viewport: '#viewport' or { "selector": "#viewport", "padding": 0 }

--
--
--
--

Data attributes for individual popovers

--

Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.

--
-- --

Methods

--

$().popover(options)

--

Initializes popovers for an element collection.

-- --

.popover('show')

--

Reveals an element's popover. Popovers whose both title and content are zero-length are never displayed.

-- {% highlight js %}$('#element').popover('show'){% endhighlight %} -- --

.popover('hide')

--

Hides an element's popover.

-- {% highlight js %}$('#element').popover('hide'){% endhighlight %} -- --

.popover('toggle')

--

Toggles an element's popover.

-- {% highlight js %}$('#element').popover('toggle'){% endhighlight %} -- --

.popover('destroy')

--

Hides and destroys an element's popover.

-- {% highlight js %}$('#element').popover('destroy'){% endhighlight %} --

Events

--
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Event TypeDescription
show.bs.popoverThis event fires immediately when the show instance method is called.
shown.bs.popoverThis event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).
hide.bs.popoverThis event is fired immediately when the hide instance method has been called.
hidden.bs.popoverThis event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).
--
--{% highlight js %} --$('#myPopover').on('hidden.bs.popover', function () { -- // do something… --}) --{% endhighlight %} --
diff --cc docs/_includes/js/tooltips.html index b8293c9f5d,fd6cc445dd..0000000000 deleted file mode 100644,100644 --- a/docs/_includes/js/tooltips.html +++ /dev/null @@@ -1,265 -1,265 +1,0 @@@ --
--

Tooltips tooltip.js

--

Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, use CSS3 for animations, and data-attributes for local title storage.

--

Tooltips with zero-length titles are never displayed.

-- --

Examples

--

Hover over the links below to see tooltips:

--
--

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.

--
-- --

Static tooltip

--

Four options are available: top, right, bottom, and left aligned.

-
- + +
+ +
+
+
+
+ +{% highlight html %} + + + + + +{% endhighlight %} + +{% highlight js %} +$('#exampleModal').on('show.bs.modal', function (event) { + var button = $(event.relatedTarget) // Button that triggered the modal + var recipient = button.data('whatever') // Extract info from data-* attributes + // If necessary, you could initiate an AJAX request here (and then do the updating in a callback). + // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead. + var modal = $(this) + modal.find('.modal-title').text('New message to ' + recipient) + modal.find('.modal-body input').val(recipient) +}) +{% endhighlight %} + +## Usage + +The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds `.modal-open` to the `` to override default scrolling behavior and generates a `.modal-backdrop` to provide a click area for dismissing shown modals when clicking outside the modal. + +### Via data attributes + +Activate a modal without writing JavaScript. Set `data-toggle="modal"` on a controller element, like a button, along with a `data-target="#foo"` or `href="#foo"` to target a specific modal to toggle. + +{% highlight html %} + +{% endhighlight %} + +### Via JavaScript + +Call a modal with id `myModal` with a single line of JavaScript: + +{% highlight js %}$('#myModal').modal(options){% endhighlight %} + +### Options + +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-backdrop=""`. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nametypedefaultdescription
backdropboolean or the string 'static'trueIncludes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn't close the modal on click.
keyboardbooleantrueCloses the modal when escape key is pressed
showbooleantrueShows the modal when initialized.
+
+ +### Methods + +#### .modal(options) + +Activates your content as a modal. Accepts an optional options `object`. + +{% highlight js %} +$('#myModal').modal({ + keyboard: false +}) +{% endhighlight %} + +#### .modal('toggle') + +Manually toggles a modal. **Returns to the caller before the modal has actually been shown or hidden** (i.e. before the `shown.bs.modal` or `hidden.bs.modal` event occurs). + +{% highlight js %}$('#myModal').modal('toggle'){% endhighlight %} + +#### .modal('show') + +Manually opens a modal. **Returns to the caller before the modal has actually been shown** (i.e. before the `shown.bs.modal` event occurs). + +{% highlight js %}$('#myModal').modal('show'){% endhighlight %} + +#### .modal('hide') + +Manually hides a modal. **Returns to the caller before the modal has actually been hidden** (i.e. before the `hidden.bs.modal` event occurs). + +{% highlight js %}$('#myModal').modal('hide'){% endhighlight %} + +### Events + +Bootstrap's modal class exposes a few events for hooking into modal functionality. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event TypeDescription
show.bs.modalThis event fires immediately when the show instance method is called. If caused by a click, the clicked element is available as the relatedTarget property of the event.
shown.bs.modalThis event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). If caused by a click, the clicked element is available as the relatedTarget property of the event.
hide.bs.modalThis event is fired immediately when the hide instance method has been called.
hidden.bs.modalThis event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).
loaded.bs.modalThis event is fired when the modal has loaded content using the remote option.
+
+ +{% highlight js %} +$('#myModal').on('hidden.bs.modal', function (e) { + // do something... +}) +{% endhighlight %} diff --cc docs/javascript/overview.md index 631ea519c5,0000000000..083c002a38 mode 100644,000000..100644 --- a/docs/javascript/overview.md +++ b/docs/javascript/overview.md @@@ -1,99 -1,0 +1,107 @@@ +--- +layout: page +title: Overview +--- + +### Individual or compiled + +Plugins can be included individually (using Bootstrap's individual `*.js` files), or all at once (using `bootstrap.js` or the minified `bootstrap.min.js`). + +
+

Using the compiled JavaScript

+

Both bootstrap.js and bootstrap.min.js contain all plugins in a single file. Include only one.

+
+ +
+

Component data attributes

+

Don't use data attributes from multiple plugins on the same element. For example, a button cannot both have a tooltip and toggle a modal. To accomplish this, use a wrapping element.

+
+ +
+

Plugin dependencies

+

Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on jQuery (this means jQuery must be included before the plugin files). Consult our bower.json to see which versions of jQuery are supported.

+
+ +### Data attributes + +You can use all Bootstrap plugins purely through the markup API without writing a single line of JavaScript. This is Bootstrap's first-class API and should be your first consideration when using a plugin. + +That said, in some situations it may be desirable to turn this functionality off. Therefore, we also provide the ability to disable the data attribute API by unbinding all events on the document namespaced with `data-api`. This looks like this: + +{% highlight js %} +$(document).off('.data-api') +{% endhighlight %} + +Alternatively, to target a specific plugin, just include the plugin's name as a namespace along with the data-api namespace like this: + +{% highlight js %} +$(document).off('.alert.data-api') +{% endhighlight %} + +
+

Only one plugin per element via data attributes

+

Don't use data attributes from multiple plugins on the same element. For example, a button cannot both have a tooltip and toggle a modal. To accomplish this, use a wrapping element.

+
+ +### Programmatic API + +We also believe you should be able to use all Bootstrap plugins purely through the JavaScript API. All public APIs are single, chainable methods, and return the collection acted upon. + +{% highlight js %} +$('.btn.danger').button('toggle').addClass('fat') +{% endhighlight %} + +All methods should accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior): + +{% highlight js %} +$('#myModal').modal() // initialized with defaults +$('#myModal').modal({ keyboard: false }) // initialized with no keyboard +$('#myModal').modal('show') // initializes and invokes show immediately +{% endhighlight %} + +Each plugin also exposes its raw constructor on a `Constructor` property: `$.fn.popover.Constructor`. If you'd like to get a particular plugin instance, retrieve it directly from an element: `$('[rel="popover"]').data('popover')`. + +#### Default settings +You can change the default settings for a plugin by modifying the plugin's `Constructor.DEFAULTS` object: + +{% highlight js %} +$.fn.modal.Constructor.DEFAULTS.keyboard = false // changes default for the modal plugin's `keyboard` option to false +{% endhighlight %} + +### No conflict + +Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur. If this happens, you may call `.noConflict` on the plugin you wish to revert the value of. + +{% highlight js %} +var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value +$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the Bootstrap functionality +{% endhighlight %} + +### Events + +Bootstrap provides custom events for most plugins' unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. `show`) is triggered at the start of an event, and its past participle form (ex. `shown`) is triggered on the completion of an action. + +All infinitive events provide `preventDefault` functionality. This provides the ability to stop the execution of an action before it starts. + +{% highlight js %} +$('#myModal').on('show.bs.modal', function (e) { + if (!data) return e.preventDefault() // stops modal from being shown +}) +{% endhighlight %} + ++### Version numbers ++ ++The version of each of Bootstrap's jQuery plugins can be accessed via the `VERSION` property of the plugin's constructor. For example, for the tooltip plugin: ++ ++{% highlight js %} ++$.fn.tooltip.Constructor.VERSION // => "{{ site.current_version }}" ++{% endhighlight %} ++ +### No special fallbacks when JavaScript is disabled + +Bootstrap's plugins don't fall back particularly gracefully when JavaScript is disabled. If you care about the user experience in this case, use [`