How to Load Java Script Again in Footer
JavaScript
Bring Bootstrap'due south components to life with over a dozen custom jQuery plugins. Easily include them all, or one by ane.
Individual or compiled
Plugins can exist included individually (using Bootstrap'southward 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.
Plugin dependencies
Some plugins and CSS components depend on other plugins. If y'all include plugins individually, brand certain to check for these dependencies in the docs. Likewise annotation that all plugins depend on jQuery (this means jQuery must be included before the plugin files). Consult our bower.json to meet which versions of jQuery are supported.
Data attributes
You lot can utilise all Bootstrap plugins purely through the markup API without writing a single line of JavaScript. This is Bootstrap'southward first-class API and should be your kickoff consideration when using a plugin.
That said, in some situations it may exist desirable to turn this functionality off. Therefore, we too provide the power to disable the information attribute API past unbinding all events on the document namespaced with data-api. This looks similar this:
$ ( certificate ). off ( '.data-api' ) Alternatively, to target a specific plugin, just include the plugin's name as a namespace forth with the information-api namespace like this:
$ ( document ). off ( '.alert.data-api' ) Only one plugin per element via data attributes
Don't employ data attributes from multiple plugins on the same element. For example, a button cannot both have a tooltip and toggle a modal. To reach this, utilize a wrapping element.
Programmatic API
We also believe y'all should be able to apply all Bootstrap plugins purely through the JavaScript API. All public APIs are single, chainable methods, and return the collection acted upon.
$ ( '.btn.danger' ). push button ( 'toggle' ). addClass ( 'fat' ) All methods should accept an optional options object, a string which targets a item method, or nothing (which initiates a plugin with default beliefs):
$ ( '#myModal' ). modal () // initialized with defaults $ ( '#myModal' ). modal ({ keyboard : fake }) // initialized with no keyboard $ ( '#myModal' ). modal ( 'bear witness' ) // initializes and invokes bear witness immediately Each plugin too exposes its raw constructor on a Constructor property: $.fn.popover.Constructor. If you'd like to go a particular plugin example, recollect it straight from an chemical element: $('[rel="popover"]').data('popover').
Default settings
You can alter the default settings for a plugin by modifying the plugin's Constructor.DEFAULTS object:
$ . fn . modal . Constructor . DEFAULTS . keyboard = imitation // changes default for the modal plugin's `keyboard` option to false No conflict
Sometimes it is necessary to utilize Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions tin can occasionally occur. If this happens, you may call .noConflict on the plugin you wish to revert the value of.
var bootstrapButton = $ . fn . button . noConflict () // return $.fn.button to previously assigned value $ . fn . bootstrapBtn = bootstrapButton // requite $().bootstrapBtn the Bootstrap functionality Events
Bootstrap provides custom events for most plugins' unique actions. Generally, these come in an infinitive and past participle grade - where the infinitive (ex. show) is triggered at the start of an event, and its past participle course (ex. shown) is triggered on the completion of an action.
As of 3.0.0, all Bootstrap events are namespaced.
All infinitive events provide preventDefault functionality. This provides the power to stop the execution of an action before it starts.
$ ( '#myModal' ). on ( 'show.bs.modal' , function ( e ) { if ( ! data ) return east . preventDefault () // stops modal from existence shown }) Sanitizer
Tooltips and Popovers utilise our built-in sanitizer to sanitize options which have HTML.
The default whiteList value is the following:
var ARIA_ATTRIBUTE_PATTERN = /^aria- [\w - ] *$/i var DefaultWhitelist = { // Global attributes allowed on any supplied chemical element below. '*' : [ 'form' , 'dir' , 'id' , 'lang' , 'part' , ARIA_ATTRIBUTE_PATTERN ], a : [ 'target' , 'href' , 'title' , 'rel' ], area : [], b : [], br : [], col : [], code : [], div : [], em : [], 60 minutes : [], h1 : [], h2 : [], h3 : [], h4 : [], h5 : [], h6 : [], i : [], img : [ 'src' , 'alt' , 'title' , 'width' , 'summit' ], li : [], ol : [], p : [], pre : [], s : [], small : [], span : [], sub : [], sup : [], strong : [], u : [], ul : [] } If you want to add together new values to this default whiteList you lot can do the following:
var myDefaultWhiteList = $ . fn . tooltip . Constructor . DEFAULTS . whiteList // To allow table elements myDefaultWhiteList . table = [] // To allow td elements and information-option attributes on td elements myDefaultWhiteList . td = [ 'data-option' ] // You can push button your custom regex to validate your attributes. // Exist careful about your regular expressions existence too lax var myCustomRegex = /^data-my-app- [\due west - ] +/ myDefaultWhiteList [ '*' ]. push ( myCustomRegex ) If you want to featherbed our sanitizer considering you prefer to employ a dedicated library, for case DOMPurify, you should exercise the following:
$ ( '#yourTooltip' ). tooltip ({ sanitizeFn : function ( content ) { return DOMPurify . sanitize ( content ) } }) Browsers without document.implementation.createHTMLDocument
In instance of browsers that don't support document.implementation.createHTMLDocument, similar Net Explorer 8, the born sanitize office returns the HTML every bit is.
If you want to perform sanitization in this case, please specify sanitizeFn and utilise an external library like DOMPurify.
Version numbers
The version of each of Bootstrap's jQuery plugins tin can be accessed via the VERSION holding of the plugin'southward constructor. For example, for the tooltip plugin:
$ . fn . tooltip . Constructor . VERSION // => "3.four.one" No special fallbacks when JavaScript is disabled
Bootstrap's plugins don't fall back particularly gracefully when JavaScript is disabled. If you lot care near the user experience in this instance, use <noscript> to explain the situation (and how to re-enable JavaScript) to your users, and/or add your own custom fallbacks.
Tertiary-party libraries
Bootstrap does non officially support third-political party JavaScript libraries like Prototype or jQuery UI. Despite .noConflict and namespaced events, there may be compatibility problems that you lot demand to prepare on your own.
Nearly transitions
For uncomplicated transition effects, include transition.js once alongside the other JS files. If you're using the compiled (or minified) bootstrap.js, there is no need to include this—it'due south already there.
What's inside
Transition.js is a basic helper for transitionEnd events besides every bit a CSS transition emulator. It'south used by the other plugins to bank check for CSS transition support and to grab hanging transitions.
Disabling transitions
Transitions can be globally disabled using the post-obit JavaScript snippet, which must come later on transition.js (or bootstrap.js or bootstrap.min.js, as the example may be) has loaded:
$ . back up . transition = false Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.
Multiple open modals not supported
Be sure not to open a modal while another is still visible. Showing more than ane modal at a time requires custom code.
Modal markup placement
Always try to place a modal's HTML lawmaking in a tiptop-level position in your document to avoid other components affecting the modal's appearance and/or functionality.
Due to how HTML5 defines its semantics, the autofocus HTML attribute has no upshot in Bootstrap modals. To achieve the same outcome, use some custom JavaScript:
$ ( '#myModal' ). on ( 'shown.bs.modal' , function () { $ ( '#myInput' ). focus () }) Examples
Static example
A rendered modal with header, body, and set of actions in the footer.
<div class= "modal fade" tabindex= "-1" part= "dialog" > <div course= "modal-dialog" role= "document" > <div course= "modal-content" > <div course= "modal-header" > <push button blazon= "button" class= "close" data-dismiss= "modal" aria-label= "Shut" ><span aria-subconscious= "true" > × </bridge></push> <h4 grade= "modal-title" >Modal title</h4> </div> <div grade= "modal-body" > <p>One fine body… </p> </div> <div class= "modal-footer" > <button blazon= "button" form= "btn btn-default" data-dismiss= "modal" >Shut</button> <button type= "button" class= "btn btn-main" >Save changes</push> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> Alive demo
Toggle a modal via JavaScript by clicking the button below. It will slide down and fade in from the top of the page.
<!-- Button trigger modal --> <button type= "button" class= "btn btn-primary btn-lg" information-toggle= "modal" data-target= "#myModal" > Launch demo modal </push> <!-- Modal --> <div form= "modal fade" id= "myModal" tabindex= "-1" role= "dialog" aria-labelledby= "myModalLabel" > <div class= "modal-dialog" office= "document" > <div grade= "modal-content" > <div grade= "modal-header" > <push button type= "push button" class= "close" data-dismiss= "modal" aria-label= "Close" ><span aria-hidden= "true" > × </span></button> <h4 course= "modal-championship" id= "myModalLabel" >Modal title</h4> </div> <div class= "modal-body" > ... </div> <div form= "modal-footer" > <button type= "button" class= "btn btn-default" data-dismiss= "modal" >Shut</button> <push type= "push" class= "btn btn-chief" >Save changes</button> </div> </div> </div> </div> Make modals accessible
Exist sure to add together role="dialog" and aria-labelledby="...", referencing the modal title, to .modal, and role="document" to the .modal-dialog itself.
Additionally, yous may give a description of your modal dialog with aria-describedby on .modal.
Embedding YouTube videos
Embedding YouTube videos in modals requires additional JavaScript not in Bootstrap to automatically stop playback and more than. See this helpful Stack Overflow post for more information.
Optional sizes
Modals take ii optional sizes, available via modifier classes to be placed on a .modal-dialog.
<!-- Big modal --> <button blazon= "push" class= "btn btn-primary" data-toggle= "modal" data-target= ".bs-instance-modal-lg" >Large modal</push> <div class= "modal fade" tabindex= "-1" office= "dialog" aria-labelledby= "myLargeModalLabel" > <div class= "modal-dialog modal-lg" role= "document" > <div class= "modal-content" > ... </div> </div> </div> <!-- Modest modal --> <push button type= "button" class= "btn btn-master" data-toggle= "modal" data-target= ".bs-case-modal-sm" >Small modal</button> <div course= "modal fade" tabindex= "-1" role= "dialog" aria-labelledby= "mySmallModalLabel" > <div form= "modal-dialog modal-sm" part= "document" > <div course= "modal-content" > ... </div> </div> </div> Remove animation
For modals that simply announced rather than fade in to view, remove the .fade grade from your modal markup.
<div course= "modal" tabindex= "-1" office= "dialog" aria-labelledby= "..." > ... </div> Using the grid system
To have reward of the Bootstrap grid organization within a modal, just nest .rowdue south within the .modal-torso so use the normal grid system classes.
<div class= "modal fade" tabindex= "-1" role= "dialog" aria-labelledby= "gridSystemModalLabel" > <div class= "modal-dialog" role= "certificate" > <div course= "modal-content" > <div class= "modal-header" > <push button type= "button" class= "close" data-dismiss= "modal" aria-label= "Shut" ><span aria-subconscious= "true" > × </bridge></button> <h4 grade= "modal-title" id= "gridSystemModalLabel" >Modal title</h4> </div> <div class= "modal-body" > <div class= "row" > <div class= "col-doctor-4" >.col-md-iv</div> <div course= "col-doc-4 col-md-offset-4" >.col-md-4 .col-md-showtime-4</div> </div> <div class= "row" > <div form= "col-md-three col-md-offset-3" >.col-md-iii .col-medico-first-iii</div> <div class= "col-md-ii col-md-offset-iv" >.col-md-2 .col-physician-offset-four</div> </div> <div class= "row" > <div form= "col-md-6 col-md-first-3" >.col-md-6 .col-md-offset-3</div> </div> <div class= "row" > <div grade= "col-sm-ix" > Level one: .col-sm-nine <div course= "row" > <div class= "col-xs-8 col-sm-6" > Level two: .col-xs-eight .col-sm-vi </div> <div class= "col-xs-4 col-sm-6" > Level 2: .col-xs-4 .col-sm-6 </div> </div> </div> </div> </div> <div class= "modal-footer" > <button type= "button" course= "btn btn-default" information-dismiss= "modal" >Shut</button> <button type= "button" class= "btn btn-primary" >Relieve changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> Have a bunch of buttons that all trigger the same modal, just with slightly unlike contents? Use event.relatedTarget and HTML information-* attributes (possibly via jQuery) to vary the contents of the modal depending on which button was clicked. Run into the Modal Events docs for details on relatedTarget,
<button type= "button" form= "btn btn-main" information-toggle= "modal" data-target= "#exampleModal" data-whatever= "@mdo" >Open modal for @mdo</button> <push type= "button" course= "btn btn-main" data-toggle= "modal" data-target= "#exampleModal" data-whatsoever= "@fatty" >Open modal for @fat</button> <button blazon= "button" class= "btn btn-primary" information-toggle= "modal" data-target= "#exampleModal" information-whatever= "@getbootstrap" >Open modal for @getbootstrap</push> ...more buttons... <div class= "modal fade" id= "exampleModal" tabindex= "-1" part= "dialog" aria-labelledby= "exampleModalLabel" > <div class= "modal-dialog" role= "document" > <div class= "modal-content" > <div class= "modal-header" > <button type= "button" class= "shut" data-dismiss= "modal" aria-label= "Close" ><span aria-hidden= "true" > × </span></button> <h4 class= "modal-title" id= "exampleModalLabel" >New message</h4> </div> <div class= "modal-body" > <form> <div grade= "form-group" > <label for= "recipient-name" class= "control-label" >Recipient:</label> <input type= "text" class= "form-control" id= "recipient-name" > </div> <div class= "course-group" > <label for= "message-text" course= "control-label" >Bulletin:</label> <textarea class= "form-control" id= "message-text" ></textarea> </div> </grade> </div> <div class= "modal-footer" > <push blazon= "button" class= "btn btn-default" information-dismiss= "modal" >Close</button> <push button blazon= "button" course= "btn btn-main" >Send bulletin</push button> </div> </div> </div> </div> $ ( '#exampleModal' ). on ( 'show.bs.modal' , function ( issue ) { var button = $ ( event . relatedTarget ) // Button that triggered the modal var recipient = push button . data ( 'whatsoever' ) // Extract info from data-* attributes // If necessary, you could initiate an AJAX request here (and and then do the updating in a callback). // Update the modal's content. Nosotros'll use jQuery here, but yous 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 ) }) Usage
The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It too adds .modal-open to the <body> to override default scrolling behavior and generates a .modal-backdrop to provide a click surface area for dismissing shown modals when clicking outside the modal.
Via information attributes
Activate a modal without writing JavaScript. Set information-toggle="modal" on a controller element, similar a button, along with a data-target="#foo" or href="#foo" to target a specific modal to toggle.
<push button type= "button" data-toggle= "modal" information-target= "#myModal" >Launch modal</button> Via JavaScript
Telephone call a modal with id myModal with a single line of JavaScript:
$ ( '#myModal' ). modal ( options ) Options
Options tin be passed via data attributes or JavaScript. For information attributes, suspend the option proper name to data-, as in data-properties="".
| Name | blazon | default | clarification |
|---|---|---|---|
| backdrop | boolean or the string 'static' | true | Includes a modal-backdrop chemical element. Alternatively, specify static for a backdrop which doesn't shut the modal on click. |
| keyboard | boolean | truthful | Closes the modal when escape key is pressed |
| show | boolean | true | Shows the modal when initialized. |
| remote | path | imitation | This option is deprecated since v3.iii.0 and has been removed in v4. Nosotros recommend instead using client-side templating or a data binding framework, or calling jQuery.load yourself. If a remote URL is provided, content volition exist loaded ane fourth dimension via jQuery's |
Methods
.modal(options)
Activates your content as a modal. Accepts an optional options object.
$ ( '#myModal' ). modal ({ keyboard : simulated }) .modal('toggle')
Manually toggles a modal. Returns to the caller before the modal has actually been shown or hidden (i.e. earlier the shown.bs.modal or hidden.bs.modal event occurs).
$ ( '#myModal' ). modal ( 'toggle' ) .modal('show')
Manually opens a modal. Returns to the caller before the modal has actually been shown (i.e. before the shown.bs.modal consequence occurs).
$ ( '#myModal' ). modal ( 'show' ) .modal('hide')
Manually hides a modal. Returns to the caller before the modal has actually been hidden (i.e. before the subconscious.bs.modal event occurs).
$ ( '#myModal' ). modal ( 'hide' ) .modal('handleUpdate')
Readjusts the modal's positioning to counter a scrollbar in case one should appear, which would make the modal jump to the left.
Just needed when the height of the modal changes while it is open.
$ ( '#myModal' ). modal ( 'handleUpdate' ) Events
Bootstrap'south modal grade exposes a few events for hooking into modal functionality.
All modal events are fired at the modal itself (i.east. at the <div form="modal">).
| Issue Type | Description |
|---|---|
| show.bs.modal | This consequence fires immediately when the show instance method is called. If caused past a click, the clicked element is bachelor as the relatedTarget belongings of the event. |
| shown.bs.modal | This event is fired when the modal has been fabricated visible to the user (will expect for CSS transitions to complete). If caused by a click, the clicked element is available every bit the relatedTarget property of the issue. |
| hide.bs.modal | This event is fired immediately when the hide case method has been called. |
| subconscious.bs.modal | This effect is fired when the modal has finished beingness hidden from the user (volition wait for CSS transitions to complete). |
| loaded.bs.modal | This event is fired when the modal has loaded content using the remote option. |
$ ( '#myModal' ). on ( 'hidden.bs.modal' , function ( e ) { // do something... }) Examples
Add together dropdown menus to nearly anything with this simple plugin, including the navbar, tabs, and pills.
Within a navbar
Inside pills
Usage
Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the .open class on the parent listing item.
On mobile devices, opening a dropdown adds a .dropdown-properties equally a tap area for closing dropdown menus when borer outside the carte, a requirement for proper iOS support. This means that switching from an open dropdown menu to a different dropdown menu requires an extra tap on mobile.
Note: The data-toggle="dropdown" aspect is relied on for closing dropdown menus at an application level, so it's a good idea to ever use it.
Via information attributes
Add data-toggle="dropdown" to a link or button to toggle a dropdown.
<div grade= "dropdown" > <push id= "dLabel" type= "push button" information-toggle= "dropdown" aria-haspopup= "true" aria-expanded= "simulated" > Dropdown trigger <span class= "caret" ></span> </push> <ul class= "dropdown-bill of fare" aria-labelledby= "dLabel" > ... </ul> </div> To proceed URLs intact with link buttons, use the data-target attribute instead of href="#".
<div class= "dropdown" > <a id= "dLabel" data-target= "#" href= "http://example.com/" data-toggle= "dropdown" role= "push button" aria-haspopup= "true" aria-expanded= "false" > Dropdown trigger <bridge grade= "caret" ></bridge> </a> <ul class= "dropdown-menu" aria-labelledby= "dLabel" > ... </ul> </div> Via JavaScript
Call the dropdowns via JavaScript:
$ ( '.dropdown-toggle' ). dropdown () data-toggle="dropdown" still required
Regardless of whether yous telephone call your dropdown via JavaScript or instead apply the information-api, data-toggle="dropdown" is ever required to exist present on the dropdown'southward trigger element.
Options
None
Methods
$().dropdown('toggle')
Toggles the dropdown carte of a given navbar or tabbed navigation.
Events
All dropdown events are fired at the .dropdown-carte'due south parent element.
All dropdown events take a relatedTarget belongings, whose value is the toggling anchor element.
| Event Blazon | Clarification |
|---|---|
| evidence.bs.dropdown | This event fires immediately when the show instance method is called. |
| shown.bs.dropdown | This consequence is fired when the dropdown has been made visible to the user (will wait for CSS transitions, to complete). |
| hide.bs.dropdown | This result is fired immediately when the hibernate instance method has been chosen. |
| hidden.bs.dropdown | This consequence is fired when the dropdown has finished being hidden from the user (will wait for CSS transitions, to complete). |
$ ( '#myDropdown' ). on ( 'show.bs.dropdown' , part () { // exercise something… }) The ScrollSpy plugin is for automatically updating nav targets based on scroll position. Scroll the expanse below the navbar and watch the active form change. The dropdown sub items will be highlighted too.
Requires relative positioning
No matter the implementation method, scrollspy requires the apply of position: relative; on the element you lot're spying on. In near cases this is the <body>. When scrollspying on elements other than the <torso>, be certain to have a height fix and overflow-y: scroll; applied.
Via data attributes
To easily add scrollspy behavior to your topbar navigation, add together data-spy="scroll" to the element you want to spy on (most typically this would exist the <body>). Then add together the data-target attribute with the ID or grade of the parent element of whatsoever Bootstrap .nav component.
torso { position : relative ; } <body data-spy= "scroll" data-target= "#navbar-example" > ... <div id= "navbar-example" > <ul class= "nav nav-tabs" office= "tablist" > ... </ul> </div> ... </torso> Via JavaScript
Afterwards calculation position: relative; in your CSS, phone call the scrollspy via JavaScript:
$ ( 'body' ). scrollspy ({ target : '#navbar-example' }) Methods
.scrollspy('refresh')
When using scrollspy in conjunction with adding or removing of elements from the DOM, you lot'll need to call the refresh method like then:
$ ( '[data-spy="whorl"]' ). each ( function () { var $spy = $ ( this ). scrollspy ( 'refresh' ) }) Options
Options tin can be passed via data attributes or JavaScript. For data attributes, append the option name to information-, as in data-offset="".
| Proper name | type | default | description |
|---|---|---|---|
| first | number | 10 | Pixels to offset from elevation when calculating position of scroll. |
Events
| Event Blazon | Description |
|---|---|
| actuate.bs.scrollspy | This event fires whenever a new particular becomes activated by the scrollspy. |
$ ( '#myScrollspy' ). on ( 'actuate.bs.scrollspy' , role () { // do something… }) Example tabs
Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus. Nested tabs are not supported.
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth main cleanse. Mustache platitude tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater european union 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 java squid. Exercitation +i labore velit, blog sartorial PBR leggings next level wes anderson artisan iv loko farm-to-table arts and crafts beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco advert vinyl cillum PBR. Human nostrud organic, assumenda labore artful magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson viii-fleck, sustainable jean shorts beard ut DIY upstanding culpa terry richardson biodiesel. Fine art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed repeat park.
Etsy mixtape wayfarers, upstanding wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid viii-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred yous probably haven't heard of them, vinyl arts and crafts beer blog stumptown. Pitchfork sustainable tofu synth chambray year.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party earlier they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche loftier life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out subcontract-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa upstanding. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Usage
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
$ ( '#myTabs a' ). click ( function ( due east ) { e . preventDefault () $ ( this ). tab ( 'show' ) }) You tin activate individual tabs in several ways:
$ ( '#myTabs a[href="#contour"]' ). tab ( 'testify' ) // Select tab past proper name $ ( '#myTabs a:beginning' ). tab ( 'show' ) // Select showtime tab $ ( '#myTabs a:terminal' ). tab ( 'evidence' ) // Select last tab $ ( '#myTabs li:eq(two) a' ). tab ( 'show' ) // Select third tab (0-indexed) 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 chemical element. Adding the nav and nav-tabs classes to the tab ul will apply the Bootstrap tab styling, while adding the nav and nav-pills classes volition apply pill styling.
<div> <!-- Nav tabs --> <ul class= "nav nav-tabs" role= "tablist" > <li role= "presentation" grade= "agile" ><a href= "#home" aria-controls= "home" function= "tab" data-toggle= "tab" >Domicile</a></li> <li role= "presentation" ><a href= "#profile" aria-controls= "profile" role= "tab" data-toggle= "tab" >Profile</a></li> <li office= "presentation" ><a href= "#messages" aria-controls= "letters" role= "tab" data-toggle= "tab" >Letters</a></li> <li role= "presentation" ><a href= "#settings" aria-controls= "settings" role= "tab" information-toggle= "tab" >Settings</a></li> </ul> <!-- Tab panes --> <div class= "tab-content" > <div role= "tabpanel" course= "tab-pane agile" id= "home" >...</div> <div role= "tabpanel" grade= "tab-pane" id= "profile" >...</div> <div part= "tabpanel" class= "tab-pane" id= "messages" >...</div> <div role= "tabpanel" course= "tab-pane" id= "settings" >...</div> </div> </div> Fade consequence
To make tabs fade in, add .fade to each .tab-pane. The get-go tab pane must also have .in to make the initial content visible.
<div course= "tab-content" > <div office= "tabpanel" class= "tab-pane fade in agile" id= "abode" >...</div> <div role= "tabpanel" class= "tab-pane fade" id= "profile" >...</div> <div role= "tabpanel" class= "tab-pane fade" id= "messages" >...</div> <div role= "tabpanel" class= "tab-pane fade" id= "settings" >...</div> </div> 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. In the higher up examples, the tabs are the <a>south with data-toggle="tab" attributes.
.tab('show')
Selects the given tab and shows its associated content. Any other tab that was previously selected becomes unselected and its associated content is hidden. Returns to the caller before the tab pane has actually been shown (i.due east. before the shown.bs.tab event occurs).
$ ( '#someTab' ). tab ( 'bear witness' ) Events
When showing a new tab, the events fire in the post-obit gild:
-
hide.bs.tab(on the current active tab) -
evidence.bs.tab(on the to-be-shown tab) -
subconscious.bs.tab(on the previous agile tab, the same one every bit for thehide.bs.tabevent) -
shown.bs.tab(on the newly-active just-shown tab, the aforementioned one as for theshow.bs.tabevent)
If no tab was already active, then the hide.bs.tab and hidden.bs.tab events volition not be fired.
| Upshot Blazon | Description |
|---|---|
| show.bs.tab | This event fires on tab show, but before the new tab has been shown. Use event.target and result.relatedTarget to target the active tab and the previous active tab (if available) respectively. |
| shown.bs.tab | This event fires on tab show subsequently a tab has been shown. Use result.target and effect.relatedTarget to target the active tab and the previous active tab (if bachelor) respectively. |
| hide.bs.tab | This event fires when a new tab is to be shown (and thus the previous active tab is to exist hidden). Use event.target and event.relatedTarget to target the electric current active tab and the new soonhoped-for-active tab, respectively. |
| hidden.bs.tab | This consequence fires after a new tab is shown (and thus the previous active tab is subconscious). Utilise event.target and consequence.relatedTarget to target the previous agile tab and the new active tab, respectively. |
$ ( 'a[data-toggle="tab"]' ). on ( 'shown.bs.tab' , function ( east ) { e . target // newly activated tab e . relatedTarget // previous active tab }) Inspired by the first-class jQuery.tipsy plugin written past 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.
Hover over the links below to run across tooltips:
Tight pants side by side level keffiyeh you probably haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney'due south fixie sustainable quinoa 8-bit american clothes take a terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A actually ironic artisan whatever keytar, scenester farm-to-tabular array banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
Static tooltip
Four options are bachelor: top, right, bottom, and left aligned.
Four directions
<button type= "push" class= "btn btn-default" data-toggle= "tooltip" data-placement= "left" title= "Tooltip on left" >Tooltip on left</push> <button type= "push button" class= "btn btn-default" data-toggle= "tooltip" data-placement= "peak" title= "Tooltip on top" >Tooltip on top</button> <push button type= "button" class= "btn btn-default" data-toggle= "tooltip" data-placement= "bottom" title= "Tooltip on bottom" >Tooltip on bottom</button> <button type= "push button" class= "btn btn-default" data-toggle= "tooltip" data-placement= "right" title= "Tooltip on right" >Tooltip on right</button> The tooltip plugin generates content and markup on need, and by default places tooltips after their trigger element.
Trigger the tooltip via JavaScript:
$ ( '#example' ). tooltip ( options ) Markup
The required markup for a tooltip is merely a data attribute and title on the HTML chemical element you wish to take a tooltip. The generated markup of a tooltip is rather unproblematic, though it does crave a position (by default, prepare to top by the plugin).
<!-- HTML to write --> <a href= "#" data-toggle= "tooltip" title= "Some tooltip text!" >Hover over me</a> <!-- Generated markup past the plugin --> <div grade= "tooltip top" function= "tooltip" > <div class= "tooltip-arrow" ></div> <div class= "tooltip-inner" > Some tooltip text! </div> </div> Options
Options tin be passed via data attributes or JavaScript. For data attributes, suspend the choice name to data-, as in information-animation="".
Note that for security reasons the sanitize, sanitizeFn and whiteList options cannot be supplied using data attributes.
| Name | Blazon | Default | Description |
|---|---|---|---|
| animation | boolean | true | Use a CSS fade transition to the tooltip |
| container | string | imitation | imitation | Appends the tooltip to a specific element. Instance: |
| delay | number | object | 0 | Delay showing and hiding the tooltip (ms) - does not use to manual trigger type If a number is supplied, delay is practical to both hide/show Object structure is: |
| html | boolean | false | Insert HTML into the tooltip. If false, jQuery's text method will exist used to insert content into the DOM. Use text if y'all're worried about XSS attacks. |
| placement | string | function | 'top' | How to position the tooltip - top | bottom | left | right | machine. When a office is used to determine the placement, it is chosen with the tooltip DOM node as its first argument and the triggering element DOM node every bit its second. The |
| selector | string | fake | If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to likewise utilise tooltips to dynamically added DOM elements (jQuery.on back up). See this and an informative case. |
| template | string | '<div class="tooltip" office="tooltip"><div grade="tooltip-arrow"></div><div grade="tooltip-inner"></div></div>' | Base of operations HTML to apply when creating the tooltip. The tooltip's The outermost wrapper element should have the |
| title | string | office | '' | Default title value if If a function is given, it will be called with its |
| trigger | string | 'hover focus' | How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; split up them with a infinite. manual cannot be combined with any other trigger. |
| viewport | cord | object | function | { selector: 'body', padding: 0 } | Keeps the tooltip inside the bounds of this element. Instance: If a function is given, it is chosen with the triggering chemical element DOM node as its only statement. The |
| sanitize | boolean | true | Enable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized. |
| whiteList | object | Default value | Object which contains allowed attributes and tags |
| sanitizeFn | null | function | null | Here you can supply your own sanitize function. This tin can be useful if you lot prefer to utilize a dedicated library to perform sanitization. |
Methods
$().tooltip(options)
Attaches a tooltip handler to an element collection.
.tooltip('testify')
Reveals an chemical element's tooltip. Returns to the caller before the tooltip has really been shown (i.e. before the shown.bs.tooltip consequence occurs). This is considered a "manual" triggering of the tooltip. Tooltips with null-length titles are never displayed.
$ ( '#element' ). tooltip ( 'show' ) .tooltip('hide')
Hides an element'due south tooltip. Returns to the caller before the tooltip has really been subconscious (i.e. before the hidden.bs.tooltip outcome occurs). This is considered a "transmission" triggering of the tooltip.
$ ( '#element' ). tooltip ( 'hide' ) .tooltip('toggle')
Toggles an element's tooltip. Returns to the caller earlier the tooltip has actually been shown or subconscious (i.e. before the shown.bs.tooltip or subconscious.bs.tooltip event occurs). This is considered a "manual" triggering of the tooltip.
$ ( '#element' ). tooltip ( 'toggle' ) .tooltip('destroy')
Hides and destroys an element'southward tooltip. Tooltips that use delegation (which are created using the selector pick) cannot be individually destroyed on descendant trigger elements.
$ ( '#element' ). tooltip ( 'destroy' ) Events
| Event Type | Description |
|---|---|
| prove.bs.tooltip | This consequence fires immediately when the evidence instance method is called. |
| shown.bs.tooltip | This upshot is fired when the tooltip has been made visible to the user (will await for CSS transitions to complete). |
| hibernate.bs.tooltip | This effect is fired immediately when the hibernate example method has been chosen. |
| hidden.bs.tooltip | This consequence is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete). |
| inserted.bs.tooltip | This event is fired later on the prove.bs.tooltip upshot when the tooltip template has been added to the DOM. |
$ ( '#myTooltip' ). on ( 'subconscious.bs.tooltip' , role () { // do something… }) Add small overlays of content, like those on the iPad, to whatsoever element for housing secondary information.
Popovers whose both championship and content are zero-length are never displayed.
Opt-in functionality
For functioning reasons, the Tooltip and Popover data-apis are opt-in, meaning y'all must initialize them yourself.
Ane way to initialize all popovers on a page would exist to select them by their information-toggle attribute:
$ ( function () { $ ( '[data-toggle="popover"]' ). popover () }) Popovers in button groups, input groups, and tables require special setting
When using popovers on elements within a .btn-group or an .input-group, or on table-related elements (<td>, <th>, <tr>, <thead>, <tbody>, <tfoot>), yous'll have to specify the choice container: 'body' (documented beneath) to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the popover is triggered).
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 utilise the popover to that <div> instead.
Multiple-line links
Sometimes you desire to add together a popover to a hyperlink that wraps multiple lines. The default behavior of the popover plugin is to center information technology horizontally and vertically. Add white-infinite: nowrap; to your anchors to avoid this.
Examples
Static popover
4 options are bachelor: 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
<button type= "button" class= "btn btn-lg btn-danger" information-toggle= "popover" title= "Popover championship" data-content= "And here's some amazing content. It'due south very engaging. Right?" >Click to toggle popover</button> Iv directions
<button type= "push button" class= "btn btn-default" data-container= "torso" information-toggle= "popover" data-placement= "left" data-content= "Vivamus sagittis lacus vel augue laoreet rutrum faucibus." > Popover on left </button> <button type= "button" class= "btn btn-default" data-container= "torso" data-toggle= "popover" information-placement= "pinnacle" data-content= "Vivamus sagittis lacus vel augue laoreet rutrum faucibus." > Popover on summit </button> <button blazon= "button" class= "btn btn-default" data-container= "body" data-toggle= "popover" data-placement= "bottom" data-content= "Vivamus sagittis lacus vel augue laoreet rutrum faucibus." > Popover on bottom </button> <push button type= "push button" class= "btn btn-default" information-container= "body" information-toggle= "popover" data-placement= "correct" data-content= "Vivamus sagittis lacus vel augue laoreet rutrum faucibus." > Popover on correct </button> Dismiss on adjacent click
Utilise 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 lot must use the <a> tag, non the <button> tag, and you besides must include the role="push button" and tabindex attributes.
<a tabindex= "0" class= "btn btn-lg btn-danger" role= "button" data-toggle= "popover" data-trigger= "focus" title= "Dismissible popover" data-content= "And here'southward some amazing content. It's very engaging. Right?" >Dismissible popover</a> Usage
Enable popovers via JavaScript:
$ ( '#instance' ). popover ( options ) Options
Options can be passed via data attributes or JavaScript. For data attributes, suspend the option proper noun to information-, as in data-blitheness="".
Note that for security reasons the sanitize, sanitizeFn and whiteList options cannot be supplied using data attributes.
| Name | Type | Default | Description |
|---|---|---|---|
| animation | boolean | true | Use a CSS fade transition to the popover |
| container | string | false | simulated | Appends the popover to a specific element. Example: |
| content | string | part | '' | Default content value if If a function is given, it will be called with its |
| filibuster | number | object | 0 | Filibuster showing and hiding the popover (ms) - does not apply to manual trigger type If a number is supplied, delay is applied to both hide/testify Object structure is: |
| html | boolean | simulated | Insert HTML into the popover. If fake, jQuery'due south text method will be used to insert content into the DOM. Utilize text if you're worried about XSS attacks. |
| placement | string | function | 'correct' | How to position the popover - top | bottom | left | right | auto. When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering chemical element DOM node equally its 2nd. The |
| selector | string | false | If 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. |
| template | string | '<div class="popover" role="tooltip"><div course="arrow"></div><h3 class="popover-title"></h3><div course="popover-content"></div></div>' | Base HTML to use when creating the popover. The popover's The popover's The outermost wrapper element should have the |
| title | string | function | '' | Default title value if If a function is given, information technology will be called with its |
| trigger | cord | 'click' | How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. transmission cannot exist combined with whatever other trigger. |
| viewport | string | object | role | { selector: 'body', padding: 0 } | Keeps the popover within the bounds of this element. Example: If a function is given, it is called with the triggering element DOM node as its only argument. The |
| sanitize | boolean | true | Enable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized. |
| whiteList | object | Default value | Object which contains immune attributes and tags |
| sanitizeFn | goose egg | part | null | Here you tin supply your own sanitize role. This can exist useful if you adopt to apply a defended library to perform sanitization. |
Information attributes for individual popovers
Options for individual popovers can alternatively be specified through the use of data attributes, equally explained above.
Methods
$().popover(options)
Initializes popovers for an element collection.
.popover('show')
Reveals an chemical element's popover. Returns to the caller before the popover has really been shown (i.e. before the shown.bs.popover event occurs). This is considered a "transmission" triggering of the popover. Popovers whose both title and content are zero-length are never displayed.
$ ( '#element' ). popover ( 'show' ) .popover('hide')
Hides an element'south popover. Returns to the caller before the popover has actually been hidden (i.eastward. earlier the subconscious.bs.popover event occurs). This is considered a "transmission" triggering of the popover.
$ ( '#element' ). popover ( 'hibernate' ) .popover('toggle')
Toggles an element's popover. Returns to the caller before the popover has actually been shown or hidden (i.east. earlier the shown.bs.popover or hidden.bs.popover event occurs). This is considered a "manual" triggering of the popover.
$ ( '#chemical element' ). popover ( 'toggle' ) .popover('destroy')
Hides and destroys an element's popover. Popovers that utilise delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
$ ( '#element' ). popover ( 'destroy' ) Events
| Event Type | Clarification |
|---|---|
| testify.bs.popover | This event fires immediately when the testify case method is chosen. |
| shown.bs.popover | This consequence is fired when the popover has been made visible to the user (will wait for CSS transitions to complete). |
| hibernate.bs.popover | This outcome is fired immediately when the hide case method has been called. |
| hidden.bs.popover | This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to consummate). |
| inserted.bs.popover | This event is fired after the bear witness.bs.popover event when the popover template has been added to the DOM. |
$ ( '#myPopover' ). on ( 'subconscious.bs.popover' , function () { // do something… }) Case alerts
Add dismiss functionality to all alert messages with this plugin.
When using a .close button, it must be the showtime child of the .alarm-dismissible and no text content may come earlier information technology in the markup.
Usage
But add data-dismiss="alert" to your shut push button to automatically give an alert close functionality. Endmost an alert removes it from the DOM.
<button type= "button" class= "shut" data-dismiss= "alert" aria-label= "Shut" > <span aria-subconscious= "truthful" > × </span> </button> To have your alerts apply animation when closing, make sure they have the .fade and .in classes already applied to them.
Methods
$().alarm()
Makes an alert listen for click events on descendant elements which have the data-dismiss="warning" attribute. (Not necessary when using the data-api's auto-initialization.)
$().alert('close')
Closes an alert by removing it from the DOM. If the .fade and .in classes are present on the chemical element, the alarm will fade out before information technology is removed.
Events
Bootstrap's alert plugin exposes a few events for hooking into alert functionality.
| Event Type | Clarification |
|---|---|
| close.bs.warning | This issue fires immediately when the close instance method is called. |
| airtight.bs.alert | This result is fired when the alert has been closed (will wait for CSS transitions to complete). |
$ ( '#myAlert' ). on ( 'airtight.bs.alert' , function () { // do something… }) Do more with buttons. Command button states or create groups of buttons for more than components like toolbars.
Stateful
Add data-loading-text="Loading..." to use a loading state on a push.
This feature is deprecated since v3.3.v and has been removed in v4.
Use whichever state you like!
For the sake of this demonstration, nosotros are using data-loading-text and $().push button('loading'), but that'due south not the simply country you tin use. Run into more on this beneath in the $().push button(string) documentation.
<button type= "push button" id= "myButton" data-loading-text= "Loading..." form= "btn btn-primary" > Loading state </button> <script> $ ( '#myButton' ). on ( 'click' , role () { var $btn = $ ( this ). push ( 'loading' ) // business logic... $btn . button ( 'reset' ) }) </script> Unmarried toggle
Add data-toggle="push button" to activate toggling on a single push.
Pre-toggled buttons need .active and aria-pressed="true"
For pre-toggled buttons, you lot must add the .active course and the aria-pressed="truthful" attribute to the button yourself.
<button type= "push" class= "btn btn-primary" information-toggle= "button" aria-pressed= "imitation" > Single toggle </push> Checkbox / Radio
Add data-toggle="buttons" to a .btn-group containing checkbox or radio inputs to enable toggling in their respective styles.
Preselected options need .active
For preselected options, you lot must add the .active class to the input'southward label yourself.
Visual checked state only updated on click
If the checked state of a checkbox push button is updated without firing a click upshot on the push button (eastward.g. via <input type="reset"> or via setting the checked belongings of the input), you will demand to toggle the .agile class on the input's characterization yourself.
<div form= "btn-group" data-toggle= "buttons" > <characterization course= "btn btn-primary active" > <input type= "checkbox" checked > Checkbox 1 (pre-checked) </characterization> <label grade= "btn btn-master" > <input type= "checkbox" > Checkbox 2 </label> <label class= "btn btn-primary" > <input type= "checkbox" > Checkbox three </label> </div>
<div grade= "btn-grouping" information-toggle= "buttons" > <characterization course= "btn btn-primary agile" > <input type= "radio" proper noun= "options" id= "option1" checked > Radio 1 (preselected) </label> <label grade= "btn btn-principal" > <input blazon= "radio" name= "options" id= "option2" > Radio 2 </label> <label class= "btn btn-primary" > <input blazon= "radio" proper noun= "options" id= "option3" > Radio 3 </label> </div> Methods
$().button('toggle')
Toggles push button state. Gives the button the appearance that it has been activated.
$().button('reset')
Resets push button land - swaps text to original text. This method is asynchronous and returns earlier the resetting has really completed.
$().push(string)
Swaps text to whatever data defined text country.
<button type= "button" id= "myStateButton" data-complete-text= "finished!" course= "btn btn-primary" > ... </button> <script> $ ( '#myStateButton' ). on ( 'click' , function () { $ ( this ). button ( 'complete' ) // push text will be "finished!" }) </script> Flexible plugin that utilizes a scattering of classes for easy toggle behavior.
Plugin dependency
Collapse requires the transitions plugin to be included in your version of Bootstrap.
Example
Click the buttons beneath to show and hibernate another element via course changes:
-
.collapsehides content -
.collapsingis applied during transitions -
.collapse.inshows content
Yous can use a link with the href aspect, or a push button with the data-target attribute. In both cases, the information-toggle="collapse" is required.
Link with href
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, arts and crafts beer labore wes anderson cred nesciunt sapiente ea proident.
<a course= "btn btn-master" function= "button" data-toggle= "collapse" href= "#collapseExample" aria-expanded= "fake" aria-controls= "collapseExample" > Link with href </a> <button class= "btn btn-chief" type= "button" data-toggle= "collapse" data-target= "#collapseExample" aria-expanded= "false" aria-controls= "collapseExample" > Push with data-target </button> <div class= "plummet" id= "collapseExample" > <div course= "well" > ... </div> </div> Piano accordion case
Extend the default collapse behavior to create an accordion with the console component.
Collapsible Grouping Detail #one
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson advertising squid. three wolf moon officia aute, not cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Advertizement vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Collapsible Group Item #2
Anim pariatur platitude reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch iii wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Advert vegan excepteur butcher vice lomo. Leggings occaecat craft beer subcontract-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Collapsible Group Item #iii
Anim pariatur platitude reprehenderit, enim eiusmod loftier life accusamus terry richardson ad squid. iii wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably oasis't heard of them accusamus labore sustainable VHS.
<div class= "panel-group" id= "piano accordion" role= "tablist" aria-multiselectable= "truthful" > <div grade= "panel panel-default" > <div form= "panel-heading" role= "tab" id= "headingOne" > <h4 form= "panel-title" > <a office= "button" data-toggle= "collapse" data-parent= "#accordion" href= "#collapseOne" aria-expanded= "true" aria-controls= "collapseOne" > Collapsible Group Item #1 </a> </h4> </div> <div id= "collapseOne" grade= "panel-collapse collapse in" role= "tabpanel" aria-labelledby= "headingOne" > <div class= "panel-body" > Anim pariatur cliche reprehenderit, enim eiusmod loftier life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Nutrient truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> <div grade= "panel panel-default" > <div class= "panel-heading" office= "tab" id= "headingTwo" > <h4 class= "panel-title" > <a form= "collapsed" role= "push button" information-toggle= "collapse" data-parent= "#accordion" href= "#collapseTwo" aria-expanded= "false" aria-controls= "collapseTwo" > Collapsible Group Item #2 </a> </h4> </div> <div id= "collapseTwo" class= "panel-collapse collapse" role= "tabpanel" aria-labelledby= "headingTwo" > <div class= "panel-trunk" > Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson advertizing squid. iii wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch three wolf moon tempor, sunt aliqua put a bird on it squid unmarried-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, arts and crafts beer labore wes anderson cred nesciunt sapiente ea proident. Advertizement vegan excepteur butcher vice lomo. Leggings occaecat craft beer subcontract-to-table, raw denim aesthetic synth nesciunt you lot probably oasis't heard of them accusamus labore sustainable VHS. </div> </div> </div> <div class= "panel panel-default" > <div grade= "panel-heading" role= "tab" id= "headingThree" > <h4 class= "console-title" > <a form= "collapsed" role= "button" data-toggle= "collapse" data-parent= "#accordion" href= "#collapseThree" aria-expanded= "false" aria-controls= "collapseThree" > Collapsible Grouping Item #3 </a> </h4> </div> <div id= "collapseThree" grade= "console-collapse collapse" role= "tabpanel" aria-labelledby= "headingThree" > <div form= "console-body" > Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson advertizing squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid unmarried-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Advertizement vegan excepteur butcher vice lomo. Leggings occaecat craft beer subcontract-to-table, raw denim artful synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> </div> It's also possible to swap out .console-bodys with .list-groups.
Collapsible list group
- Bootply
- 1 itmus ac facilin
- 2d eros
Make expand/collapse controls attainable
Be sure to add aria-expanded to the control element. This attribute explicitly defines the current country of the collapsible chemical element to screen readers and similar assistive technologies. If the collapsible element is closed by default, it should have a value of aria-expanded="imitation". If yous've set the collapsible element to be open by default using the in course, set aria-expanded="truthful" on the control instead. The plugin volition automatically toggle this attribute based on whether or not the collapsible chemical element has been opened or closed.
Additionally, if your command element is targeting a single collapsible element – i.e. the data-target attribute is pointing to an id selector – you may add an additional aria-controls attribute to the control element, containing the id of the collapsible element. Modern screen readers and similar assistive technologies make use of this attribute to provide users with boosted shortcuts to navigate directly to the collapsible element itself.
Usage
The collapse plugin utilizes a few classes to handle the heavy lifting:
-
.collapsehides the content -
.plummet.inshows the content -
.collapsingis added when the transition starts, and removed when it finishes
These classes tin be found in component-animations.less.
Via data attributes
Only add data-toggle="collapse" and a data-target to the element to automatically assign control of a collapsible element. The data-target aspect accepts a CSS selector to apply the collapse to. Be sure to add together the class collapse to the collapsible element. If yous'd similar it to default open, add the additional class in.
To add together accordion-like group direction to a collapsible control, add the data attribute information-parent="#selector". Refer to the demo to see this in activeness.
Via JavaScript
Enable manually with:
$ ( '.plummet' ). collapse () Options
Options can be passed via data attributes or JavaScript. For data attributes, append the selection name to data-, every bit in data-parent="".
| Name | type | default | clarification |
|---|---|---|---|
| parent | selector | false | If a selector is provided, then all collapsible elements under the specified parent volition be closed when this collapsible item is shown. (similar to traditional squeeze box behavior - this is dependent on the panel class) |
| toggle | boolean | true | Toggles the collapsible element on invocation |
Methods
.collapse(options)
Activates your content as a collapsible element. Accepts an optional options object.
$ ( '#myCollapsible' ). collapse ({ toggle : false }) .collapse('toggle')
Toggles a collapsible element to shown or hidden. Returns to the caller before the collapsible chemical element has actually been shown or hidden (i.e. earlier the shown.bs.collapse or subconscious.bs.collapse event occurs).
.plummet('evidence')
Shows a collapsible chemical element. Returns to the caller before the collapsible element has actually been shown (i.e. before the shown.bs.plummet result occurs).
.plummet('hide')
Hides a collapsible chemical element. Returns to the caller before the collapsible element has actually been hidden (i.e. before the subconscious.bs.collapse outcome occurs).
Events
Bootstrap'south plummet class exposes a few events for hooking into plummet functionality.
| Consequence Type | Description |
|---|---|
| evidence.bs.collapse | This event fires immediately when the show instance method is chosen. |
| shown.bs.collapse | This upshot is fired when a collapse element has been fabricated visible to the user (will look for CSS transitions to complete). |
| hide.bs.collapse | This event is fired immediately when the hide method has been called. |
| hidden.bs.collapse | This event is fired when a plummet element has been subconscious from the user (will wait for CSS transitions to complete). |
$ ( '#myCollapsible' ). on ( 'hidden.bs.plummet' , function () { // practice something… }) A slideshow component for cycling through elements, like a carousel. Nested carousels are non supported.
Examples
<div id= "carousel-instance-generic" grade= "carousel slide" data-ride= "carousel" > <!-- Indicators --> <ol course= "carousel-indicators" > <li information-target= "#carousel-example-generic" data-slide-to= "0" course= "active" ></li> <li information-target= "#carousel-example-generic" data-slide-to= "i" ></li> <li data-target= "#carousel-example-generic" information-slide-to= "two" ></li> </ol> <!-- Wrapper for slides --> <div class= "carousel-inner" role= "listbox" > <div course= "detail agile" > <img src= "..." alt= "..." > <div grade= "carousel-caption" > ... </div> </div> <div course= "item" > <img src= "..." alt= "..." > <div class= "carousel-caption" > ... </div> </div> ... </div> <!-- Controls --> <a form= "left carousel-control" href= "#carousel-example-generic" role= "push" data-slide= "prev" > <span class= "glyphicon glyphicon-chevron-left" aria-hidden= "true" ></span> <span class= "sr-but" >Previous</span> </a> <a course= "right carousel-control" href= "#carousel-example-generic" office= "button" information-slide= "next" > <span course= "glyphicon glyphicon-chevron-right" aria-hidden= "true" ></span> <bridge class= "sr-merely" >Next</bridge> </a> </div> Accessibility issue
The carousel component is generally non compliant with accessibility standards. If you need to be compliant, please consider other options for presenting your content.
Transition animations not supported in Internet Explorer 8 & 9
Bootstrap exclusively uses CSS3 for its animations, but Internet Explorer viii & 9 don't support the necessary CSS properties. Thus, there are no slide transition animations when using these browsers. We have intentionally decided not to include jQuery-based fallbacks for the transitions.
Initial active chemical element required
The .agile grade needs to be added to one of the slides. Otherwise, the carousel will not exist visible.
Glyphicon icons not necessary
The .glyphicon .glyphicon-chevron-left and .glyphicon .glyphicon-chevron-right classes are not necessarily needed for the controls. Bootstrap provides .icon-prev and .icon-next as plain unicode alternatives.
Optional captions
Add captions to your slides easily with the .carousel-caption element within whatever .item. Identify only about any optional HTML within in that location and it will be automatically aligned and formatted.
Kickoff slide label
Nulla vitae elit libero, a pharetra augue mollis interdum.
2d slide label
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Third slide label
Praesent commodo cursus magna, vel scelerisque nisl consectetur.
Previous Side by side
<div class= "item" > <img src= "..." alt= "..." > <div course= "carousel-caption" > <h3>...</h3> <p>...</p> </div> </div> Usage
Multiple carousels
Carousels require the utilize of an id on the outermost container (the .carousel) for carousel controls to role properly. When adding multiple carousels, or when changing a carousel's id, be sure to update the relevant controls.
Via data attributes
Utilise data attributes to hands command the position of the carousel. data-slide accepts the keywords prev or next, which alters the slide position relative to its electric current position. Alternatively, utilize data-slide-to to pass a raw slide index to the carousel data-slide-to="2", which shifts the slide position to a detail index kickoff with 0.
The data-ride="carousel" aspect is used to marking a carousel as animating starting at page load. It cannot be used in combination with (redundant and unnecessary) explicit JavaScript initialization of the same carousel.
Via JavaScript
Telephone call carousel manually with:
$ ( '.carousel' ). carousel () Options
Options can exist passed via data attributes or JavaScript. For data attributes, suspend the option name to data-, as in data-interval="".
| Name | blazon | default | description |
|---|---|---|---|
| interval | number | 5000 | The amount of time to delay between automatically cycling an item. If imitation, carousel volition not automatically bicycle. |
| interruption | cord | null | "hover" | If fix to "hover", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. If set to null, hovering over the carousel won't pause it. |
| wrap | boolean | true | Whether the carousel should wheel continuously or accept hard stops. |
| keyboard | boolean | true | Whether the carousel should react to keyboard events. |
Methods
.carousel(options)
Initializes the carousel with an optional options object and starts cycling through items.
$ ( '.carousel' ). carousel ({ interval : 2000 }) .carousel('cycle')
Cycles through the carousel items from left to right.
.carousel('pause')
Stops the carousel from cycling through items.
.carousel(number)
Cycles the carousel to a item frame (0 based, like to an array).
.carousel('prev')
Cycles to the previous item.
.carousel('next')
Cycles to the side by side item.
Events
Bootstrap's carousel grade exposes two events for hooking into carousel functionality.
Both events have the following boosted properties:
-
direction: The direction in which the carousel is sliding (either"left"or"correct"). -
relatedTarget: The DOM element that is existence slid into place as the active item.
All carousel events are fired at the carousel itself (i.due east. at the <div class="carousel">).
| Consequence Type | Clarification |
|---|---|
| slide.bs.carousel | This issue fires immediately when the slide example method is invoked. |
| slid.bs.carousel | This event is fired when the carousel has completed its slide transition. |
$ ( '#myCarousel' ). on ( 'slide.bs.carousel' , function () { // practice something… }) Case
The affix plugin toggles position: stock-still; on and off, emulating the upshot found with position: gummy;. The subnavigation on the right is a live demo of the affix plugin.
Usage
Use the braze plugin via data attributes or manually with your ain JavaScript. In both situations, you must provide CSS for the positioning and width of your affixed content.
Note: Practise not utilize the affix plugin on an chemical element contained in a relatively positioned element, such every bit a pulled or pushed cavalcade, due to a Safari rendering problems.
Positioning via CSS
The affix plugin toggles betwixt 3 classes, each representing a particular state: .affix, .braze-top, and .braze-bottom. You lot must provide the styles, with the exception of position: fixed; on .braze, for these classes yourself (contained of this plugin) to handle the bodily positions.
Here's how the braze plugin works:
- To start, the plugin adds
.braze-topto bespeak the element is in its top-most position. At this point no CSS positioning is required. - Scrolling by the element yous want affixed should trigger the actual affixing. This is where
.affixreplaces.affix-meridianand setsposition: fixed;(provided by Bootstrap's CSS). - If a lesser offset is defined, scrolling by it should replace
.affixwith.affix-bottom. Since offsets are optional, setting one requires y'all to set the appropriate CSS. In this case, addposition: absolute;when necessary. The plugin uses the information attribute or JavaScript choice to determine where to position the element from there.
Follow the above steps to set your CSS for either of the usage options below.
Via data attributes
To easily add together affix behavior to any element, just add data-spy="affix" to the element you lot desire to spy on. Use offsets to define when to toggle the pinning of an chemical element.
<div data-spy= "affix" data-kickoff-top= "lx" information-commencement-lesser= "200" > ... </div> Via JavaScript
Call the braze plugin via JavaScript:
$ ( '#myAffix' ). affix ({ offset : { top : 100 , bottom : function () { return ( this . lesser = $ ( '.footer' ). outerHeight ( truthful )) } } }) Options
Options can be passed via information attributes or JavaScript. For data attributes, suspend the option name to data-, as in data-showtime-elevation="200".
| Name | type | default | description |
|---|---|---|---|
| showtime | number | function | object | 10 | Pixels to beginning from screen when computing position of scroll. If a single number is provided, the start will be practical in both height and bottom directions. To provide a unique, bottom and elevation offset just provide an object first: { tiptop: 10 } or offset: { top: 10, bottom: five }. Employ a function when y'all need to dynamically calculate an offset. |
| target | selector | node | jQuery chemical element | the window object | Specifies the target element of the affix. |
Methods
.affix(options)
Activates your content as affixed content. Accepts an optional options object.
$ ( '#myAffix' ). affix ({ offset : xv }) .braze('checkPosition')
Recalculates the land of the braze based on the dimensions, position, and scroll position of the relevant elements. The .affix, .affix-top, and .affix-bottom classes are added to or removed from the affixed content according to the new state. This method needs to be chosen whenever the dimensions of the affixed content or the target element are changed, to ensure correct positioning of the affixed content.
$ ( '#myAffix' ). affix ( 'checkPosition' ) Events
Bootstrap's affix plugin exposes a few events for hooking into affix functionality.
| Consequence Type | Description |
|---|---|
| braze.bs.affix | This event fires immediately before the chemical element has been affixed. |
| affixed.bs.affix | This event is fired after the element has been affixed. |
| affix-meridian.bs.affix | This event fires immediately earlier the element has been affixed-top. |
| affixed-height.bs.affix | This event is fired after the element has been affixed-top. |
| affix-bottom.bs.braze | This event fires immediately before the element has been affixed-bottom. |
| affixed-bottom.bs.affix | This result is fired later the element has been affixed-lesser. |
Source: https://getbootstrap.com/docs/3.4/javascript/
0 Response to "How to Load Java Script Again in Footer"
Postar um comentário