From: Mark Otto Date: Sat, 27 Jul 2013 02:46:42 +0000 (-0700) Subject: Unfuck JS docs spacing and closing divs X-Git-Tag: v3.0.0-rc1~17^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20040868c120f00889ee835a0b250551607d24b7;p=thirdparty%2Fbootstrap.git Unfuck JS docs spacing and closing divs --- diff --git a/javascript.html b/javascript.html index e0ddae0a1d..f54a21523d 100644 --- a/javascript.html +++ b/javascript.html @@ -222,8 +222,6 @@ $('#myModal').on('show.bs.modal', function (e) { {% endhighlight %} - -

Usage

Via data attributes

@@ -337,74 +335,31 @@ $('#myModal').on('hidden.bs.modal', function () { - -
- - + +
+ - -

Add dropdown menus to nearly anything with this simple plugin, including the navbar, tabs, and pills.

- -

Within a navbar

- - -

Within tabs

-
- +
+
+
+ + +

Within tabs

+
+ +
- + -

Via data attributes

-

Add data-toggle="dropdown" to a link or button to toggle a dropdown.

+

Via data attributes

+

Add data-toggle="dropdown" to a link or button to toggle a dropdown.

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

Via JavaScript

-

Call the dropdowns via JavaScript:

+

Via JavaScript

+

Call the dropdowns via JavaScript:

{% highlight js %} $('.dropdown-toggle').dropdown() {% endhighlight %} -

Options

-

None

+

Options

+

None

-

Methods

-

$().dropdown('toggle')

-

A programmatic api for toggling menus for a given navbar or tabbed navigation.

- +

Methods

+

$().dropdown('toggle')

+

A programmatic api for toggling menus for a given navbar or tabbed navigation.

+ - -
- + +
+ -

Example in navbar

-

The ScrollSpy plugin is for automatically updating nav targets based on scroll position. Scroll the area below the navbar and watch the active class change. The dropdown sub items will be highlighted as well.

-
- -
-

@fat

-

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

-

@mdo

-

Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.

-

one

-

Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.

-

two

-

In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.

-

three

-

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

-

Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats. -

-
-
+

Example in navbar

+

The ScrollSpy plugin is for automatically updating nav targets based on scroll position. Scroll the area below the navbar and watch the active class change. The dropdown sub items will be highlighted as well.

+
+ +
+

@fat

+

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

+

@mdo

+

Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.

+

one

+

Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.

+

two

+

In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.

+

three

+

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

+

Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats. +

+
+
-

Usage

+

Usage

-

Via data attributes

-

To easily add scrollspy behavior to your topbar navigation, add data-spy="scroll" to the element you want to spy on (most typically this would be the <body>. Then add the data-target attribute with the ID or class of the parent element of any Bootstrap .nav component.

+

Via data attributes

+

To easily add scrollspy behavior to your topbar navigation, add data-spy="scroll" to the element you want to spy on (most typically this would be the <body>. Then add the data-target attribute with the ID or class of the parent element of any Bootstrap .nav component.

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

Via JavaScript

-

Call the scrollspy via JavaScript:

+

Via JavaScript

+

Call the scrollspy via JavaScript:

{% highlight js %} $('#navbar-example').scrollspy() {% endhighlight %} -
-

Resolvable ID targets required

-

Navbar links must have resolvable id targets. For example, a <a href="#home">home</a> must correspond to something in the DOM like <div id="home"></div>.

-
+
+

Resolvable ID targets required

+

Navbar links must have resolvable id targets. For example, a <a href="#home">home</a> must correspond to something in the DOM like <div id="home"></div>.

+
-

Methods

-

.scrollspy('refresh')

-

When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:

+

Methods

+

.scrollspy('refresh')

+

When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:

{% highlight js %} $('[data-spy="scroll"]').each(function () { var $spy = $(this).scrollspy('refresh') @@ -558,95 +552,91 @@ $('[data-spy="scroll"]').each(function () { {% endhighlight %} -

Options

-

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

- - - - - - - - - - - - - - - - - -
Nametypedefaultdescription
offsetnumber10Pixels to offset from top when calculating position of scroll.
- -

Events

- - - - - - - - - - - - - -
Event TypeDescription
activateThis event fires whenever a new item becomes activated by the scrollspy.
+

Options

+

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

+ + + + + + + + + + + + + + + + + +
Nametypedefaultdescription
offsetnumber10Pixels to offset from top when calculating position of scroll.
+ +

Events

+ + + + + + + + + + + + + +
Event TypeDescription
activateThis event fires whenever a new item becomes activated by the scrollspy.
{% highlight js %} $('#myScrollspy').on('activate.bs.scrollspy', function () { // do something… }) {% endhighlight %} - - - - - -
- +
-

Example tabs

-

Add quick, dynamic tab functionality to transition 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.

-
- - -
-
+ +
+ -
+

Example tabs

+

Add quick, dynamic tab functionality to transition 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.

+
+ + +
+
-

Usage

-

Enable tabbable tabs via JavaScript (each tab needs to be activated individually):

+

Usage

+

Enable tabbable tabs via JavaScript (each tab needs to be activated individually):

{% highlight js %} $('#myTab a').click(function (e) { e.preventDefault(); @@ -662,8 +652,8 @@ $('#myTab a:last').tab('show'); // Select last tab $('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed) {% endhighlight %} -

Markup

-

You can activate a tab or pill navigation without writing any JavaScript by simply specifying data-toggle="tab" or data-toggle="pill" on an element. Adding the nav and nav-tabs classes to the tab ul will apply the Bootstrap tab styling.

+

Markup

+

You can activate a tab or pill navigation without writing any JavaScript by simply specifying data-toggle="tab" or data-toggle="pill" on an element. Adding the nav and nav-tabs classes to the tab ul will apply the Bootstrap tab styling.

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

To make tabs fade in, add .fade to each .tab-pane.

+

To make tabs fade in, add .fade to each .tab-pane.

-

Methods

-

$().tab

-

- Activates a tab element and content container. Tab should have either a data-target or an href targeting a container node in the DOM. -

+

Methods

+

$().tab

+

+ Activates a tab element and content container. Tab should have either a data-target or an href targeting a container node in the DOM. +

{% highlight html %}
- -
- -

Examples

-

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.

-

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. -

-
- -

Four directions

-
-
- - - - -
-
+ +
+ -
-

Tooltips in button groups and input groups require special setting

-

When using tooltips 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 tooltip is triggered).

-
+

Examples

+

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.

+

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. +

+
-
+

Four directions

+
+
+ + + + +
+
+ +
+

Tooltips in button groups and input groups require special setting

+

When using tooltips 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 tooltip is triggered).

+
-

Usage

-

Trigger the tooltip via JavaScript:

+

Usage

+

Trigger the tooltip via JavaScript:

{% highlight js %} $('#example').tooltip(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 tooltip
htmlbooleanfalseInsert HTML into the tooltip. 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'top'how to position the tooltip - top | bottom | left | right | auto.
When "auto" is specified, it will dynamically reorient the tooltip. For example, if placment is "auto left", the tooltip will display to the left when possible, otherwise it will display right.
selectorstringfalseIf a selector is provided, tooltip objects will be delegated to the specified targets.
titlestring | function''default title value if title tag isn't present
triggerstring'hover focus'how tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
delaynumber | object0 -

delay showing and hiding the tooltip (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 }

-
containerstring | falsefalse -

Appends the tooltip to a specific element. Example: container: 'body'

-
-
-

Data attributes for individual tooltips

-

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

-
+

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 tooltip
htmlbooleanfalseInsert HTML into the tooltip. 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'top'how to position the tooltip - top | bottom | left | right | auto.
When "auto" is specified, it will dynamically reorient the tooltip. For example, if placment is "auto left", the tooltip will display to the left when possible, otherwise it will display right.
selectorstringfalseIf a selector is provided, tooltip objects will be delegated to the specified targets.
titlestring | function''default title value if title tag isn't present
triggerstring'hover focus'how tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
delaynumber | object0 +

delay showing and hiding the tooltip (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 }

+
containerstring | falsefalse +

Appends the tooltip to a specific element. Example: container: 'body'

+
+
+

Data attributes for individual tooltips

+

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

+
-

Markup

+

Markup

{% highlight html %} Hover over me {% endhighlight %} -

Methods

+

Methods

+ +

$().tooltip(options)

+

Attaches a tooltip handler to an element collection.

-

$().tooltip(options)

-

Attaches a tooltip handler to an element collection.

+

.tooltip('show')

+

Reveals an element's tooltip.

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

.tooltip('show')

-

Reveals an element's tooltip.

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

.tooltip('hide')

+

Hides an element's tooltip.

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

.tooltip('hide')

-

Hides an element's tooltip.

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

.tooltip('toggle')

+

Toggles an element's tooltip.

+ {% highlight js %}$('#element').tooltip('toggle'){% endhighlight %} + +

.tooltip('destroy')

+

Hides and destroys an element's tooltip.

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

.tooltip('toggle')

-

Toggles an element's tooltip.

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

.tooltip('destroy')

-

Hides and destroys an element's tooltip.

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

Examples

+

Add small overlays of content, like those on the iPad, to any element for housing secondary information. Hover over the button to trigger the popover.

+
+

Plugin dependency

+

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

+
+
+

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).

+
- -
-