diff --git a/javascript.html b/javascript.html index 5188fa7d3e..069e9cbd33 100644 --- a/javascript.html +++ b/javascript.html @@ -228,45 +228,47 @@ $('#myModal').on('show.bs.modal', function (e) {

Options

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
Nametypedefaultdescription
backdropbooleantrueIncludes 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.
remotepathfalse

If a remote URL is provided, content will be loaded via jQuery's load method and injected into the .modal-body. If you're using the data api, you may alternatively use the href tag to specify the remote source. An example of this is shown below:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -
Nametypedefaultdescription
backdropbooleantrueIncludes 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.
remotepathfalse

If a remote URL is provided, content will be loaded via jQuery's load method and injected into the .modal-body. If you're using the data api, you may alternatively use the href tag to specify the remote source. An example of this is shown below:

{% highlight html %} Click me {% endhighlight %} -
+
+

Methods

@@ -292,32 +294,34 @@ $('#myModal').modal({

Events

Bootstrap's modal class exposes a few events for hooking into modal functionality.

- - - - - - - - - - - - - - - - - - - - - - - - - -
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete).
hideThis event is fired immediately when the hide instance method has been called.
hiddenThis event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete).
hideThis event is fired immediately when the hide instance method has been called.
hiddenThis event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).
+
{% highlight js %} $('#myModal').on('hidden.bs.modal', function () { // do something… @@ -546,40 +550,44 @@ $('[data-spy="scroll"]').each(function () {

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.
+
+ + + + + + + + + + + + + + + + + +
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.
+
+ + + + + + + + + + + + + +
Event TypeDescription
activateThis event fires whenever a new item becomes activated by the scrollspy.
+
{% highlight js %} $('#myScrollspy').on('activate.bs.scrollspy', function () { // do something… @@ -685,24 +693,26 @@ $('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed) {% endhighlight %}

Events

- - - - - - - - - - - - - - - - - -
Event TypeDescription
showThis event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
shownThis event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
+
+ + + + + + + + + + + + + + + + + +
Event TypeDescription
showThis event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
shownThis event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
+
{% highlight js %} $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { e.target // activated tab @@ -752,72 +762,74 @@ $('#example').tooltip(options)

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'

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

@@ -850,32 +862,34 @@ $('#example').tooltip(options) {% highlight js %}$('#element').tooltip('destroy'){% endhighlight %}

Events

- - - - - - - - - - - - - - - - - - - - - - - - - -
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).
hideThis event is fired immediately when the hide instance method has been called.
hiddenThis event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).
hideThis event is fired immediately when the hide instance method has been called.
hiddenThis event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).
+
{% highlight js %} $('#myTooltip').on('hidden.bs.tooltip', function () { // do something… @@ -970,78 +984,80 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {

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 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 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 if a selector is provided, tooltip 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.
triggerstring'click'how popover is triggered - click | hover | focus | manual
titlestring | function''default title value if title attribute isn't present
contentstring | function''default content value if data-content attribute isn't present
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 }

-
containerstring | falsefalse -

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

-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nametypedefaultdescription
animationbooleantrueapply a CSS fade transition to the tooltip
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 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 if a selector is provided, tooltip 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.
triggerstring'click'how popover is triggered - click | hover | focus | manual
titlestring | function''default title value if title attribute isn't present
contentstring | function''default content value if data-content attribute isn't present
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 }

+
containerstring | falsefalse +

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

+
+

Data attributes for individual popovers

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

@@ -1070,32 +1086,34 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {

Hides and destroys an element's popover.

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

Events

- - - - - - - - - - - - - - - - - - - - - - - - - -
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).
hideThis event is fired immediately when the hide instance method has been called.
hiddenThis event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).
hideThis event is fired immediately when the hide instance method has been called.
hiddenThis 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… @@ -1152,24 +1170,26 @@ $('#myPopover').on('hidden.bs.popover', function () {

Events

Bootstrap's alert class exposes a few events for hooking into alert functionality.

- - - - - - - - - - - - - - - - - -
Event TypeDescription
closeThis event fires immediately when the close instance method is called.
closedThis event is fired when the alert has been closed (will wait for CSS transitions to complete).
+
+ + + + + + + + + + + + + + + + + +
Event TypeDescription
closeThis event fires immediately when the close instance method is called.
closedThis event is fired when the alert has been closed (will wait for CSS transitions to complete).
+
{% highlight js %} $('#my-alert').bind('closed.bs.alert', function () { // do something… @@ -1444,31 +1464,32 @@ $(".collapse").collapse()

Options

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

- - - - - - - - - - - - - - - - - - - - - - - -
Nametypedefaultdescription
parentselectorfalseIf selector then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior)
togglebooleantrueToggles the collapsible element on invocation
- +
+ + + + + + + + + + + + + + + + + + + + + + + +
Nametypedefaultdescription
parentselectorfalseIf selector then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior)
togglebooleantrueToggles the collapsible element on invocation
+

Methods

@@ -1491,34 +1512,36 @@ $('#myCollapsible').collapse({

Events

Bootstrap's collapse class exposes a few events for hooking into collapse functionality.

- - - - - - - - - - - - - - - - - - - - - - - - - -
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).
hide - This event is fired immediately when the hide method has been called. -
hiddenThis event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Event TypeDescription
showThis event fires immediately when the show instance method is called.
shownThis event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).
hide + This event is fired immediately when the hide method has been called. +
hiddenThis event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).
+
{% highlight js %} $('#myCollapsible').on('hidden.bs.collapse', function () { // do something… @@ -1661,30 +1684,32 @@ $('.carousel').carousel()

Options

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

- - - - - - - - - - - - - - - - - - - - - - - -
Nametypedefaultdescription
intervalnumber5000The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.
pausestring"hover"Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Nametypedefaultdescription
intervalnumber5000The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.
pausestring"hover"Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.
+

Methods

@@ -1714,24 +1739,26 @@ $('.carousel').carousel({

Events

Bootstrap's carousel class exposes two events for hooking into carousel functionality.

- - - - - - - - - - - - - - - - - -
Event TypeDescription
slideThis event fires immediately when the slide instance method is invoked.
slidThis event is fired when the carousel has completed its slide transition.
+
+ + + + + + + + + + + + + + + + + +
Event TypeDescription
slideThis event fires immediately when the slide instance method is invoked.
slidThis event is fired when the carousel has completed its slide transition.
+
{% highlight js %} $('#myCarousel').on('slide.bs.carousel', function () { // do something… @@ -1787,22 +1814,25 @@ $('#myCarousel').on('slide.bs.carousel', function () {

Options

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

- - - - - - - - - - - - - - - - - -
Nametypedefaultdescription
offsetnumber | function | object10Pixels to offset from screen when calculating position of scroll. If a single number is provided, the offset will be applied in both top and left directions. To provide a unique, bottom and top offset just provide an object offset: { top: 10 } or offset: { top: 10, bottom: 5 }. Use a function when you need to dynamically calculate an offset.
+
+ + + + + + + + + + + + + + + + + +
Nametypedefaultdescription
offsetnumber | function | object10Pixels to offset from screen when calculating position of scroll. If a single number is provided, the offset will be applied in both top and left directions. To provide a unique, bottom and top offset just provide an object offset: { top: 10 } or offset: { top: 10, bottom: 5 }. Use a function when you need to dynamically calculate an offset.
+
+