A tlangpuiin

Mimal emaw, khawlkhawm emaw a ni thei

Plugins chu pakhat zel (Bootstrap-a *.jsfile hrang hrang hmangin), a nih loh leh vawi khatah (hman bootstrap.jsemaw, minified emaw hmangin bootstrap.min.js) dah theih a ni.

JavaScript compile tawh hmangin

Both bootstrap.jsleh bootstrap.min.jsplugin zawng zawng file pakhatah a awm vek. Pakhat chauh telh bawk ang che.

Plugin-a innghat thilte

Plugin leh CSS component thenkhat chu plugin dang a innghat a ni. Plugin te chu pakhat zel i dah tel a nih chuan docs ah hian heng dependencies te hi check ngei ngei tur a ni. Tin, plugin zawng zawng hi jQuery ah an innghat tih hre bawk ang che (hei hian plugin files hmain jQuery hi a tel tur a ni tihna a ni). jQuery version eng ber nge support tih hriat duh chuan our hi zawt rawh .bower.json

Data attribute te hi a ni

Bootstrap plugin zawng zawng hi JavaScript line khat pawh ziak lovin markup API hmang chauhvin i hmang thei ang. Hei hi Bootstrap-a first-class API a ni a, plugin i hman hunah i ngaihtuah hmasak ber tur a ni.

Chutiang a nih lai chuan, dinhmun thenkhatah chuan he functionality hi off hi duhthusam a ni thei. Chuvangin, document namespaced-a thil thleng zawng zawng unbind-a data attribute API tihtawp theihna pawh kan pe bawk data-api. Hei hi hetiang hian a lang:

$(document).off('.data-api')

A dang pawhin, plugin bik target tur chuan plugin hming chu namespace atan data-api namespace nen hetiang hian dah mai rawh:

$(document).off('.alert.data-api')

Data attribute hmangin element khatah plugin pakhat chauh a awm

Element khata plugin tam tak atanga data attribute hmang suh. Entirnan, button pakhat hian tooltip a nei ve ve thei lo va, modal a toggle thei bawk. Chutiang ti thei tur chuan wrapping element hmang la.

Programmatic API hmanga siam a ni

Tin, Bootstrap plugin zawng zawng hi JavaScript API hmang chauhvin i hmang thei tur a ni tih kan ring bawk. Public API zawng zawng hi single, chainable method a ni a, collection acted on chu a rawn pe kir vek a ni.

$('.btn.danger').button('toggle').addClass('fat')

Method zawng zawng hian optional options object, method bik target tu string emaw, engmah (default behavior hmanga plugin initiate tu) emaw an pawm tur a ni:

$('#myModal').modal()                      // initialized with defaults
$('#myModal').modal({ keyboard: false })   // initialized with no keyboard
$('#myModal').modal('show')                // initializes and invokes show immediately

Plugin tin hian an raw constructor chu Constructorproperty pakhatah an expose bawk: $.fn.popover.Constructor. Plugin instance bik i hmuh duh chuan element atanga direct-in la chhuak rawh: $('[rel="popover"]').data('popover').

Settings hmasa ber a ni

Plugin pakhat tana default settings chu plugin Constructor.DEFAULTSobject chu siam danglamin i thlak thei ang:

$.fn.modal.Constructor.DEFAULTS.keyboard = false // changes default for the modal plugin's `keyboard` option to false

Inhnialna a awm lo

A chang chuan Bootstrap plugins te hi UI framework dang nen hman a ngai thin. Hetiang dinhmunah hian namespace collision a awm fo thin. Chutiang a nih chuan i .noConflictvalue revert duh plugin chu i call thei ang.

var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
$.fn.bootstrapBtn = bootstrapButton            // give $().bootstrapBtn the Bootstrap functionality

Thil thlengte

Bootstrap hian plugin tam zawkte thiltih danglam bik atan custom event a pe a. A tlangpuiin, hengte hi infinitive leh past participle form-ah an lo kal a - chutah chuan showthilthleng pakhat tan tirh lamah infinitive (ex. ) chu a insiam a, a past participle form (ex. shown) chu thiltih zawh hunah a insiam a ni.

3.0.0 atang khan Bootstrap event zawng zawng hi namespaced vek a ni.

Infinitive event zawng zawng hian preventDefaultfunctionality an pe vek a. Hei hian action pakhat execution chu a tan hmaa tihtawp theihna a pe a ni.

$('#myModal').on('show.bs.modal', function (e) {
  if (!data) return e.preventDefault() // stops modal from being shown
})

Sanitizer hman a ni

Tooltips leh Popovers te hian kan built-in sanitizer hmangin HTML pawmtu option te chu sanitize turin an hmang thin.

Default whiteListvalue chu a hnuaia mi ang hian a ni:

var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
var DefaultWhitelist = {
  // Global attributes allowed on any supplied element below.
  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  a: ['target', 'href', 'title', 'rel'],
  area: [],
  b: [],
  br: [],
  col: [],
  code: [],
  div: [],
  em: [],
  hr: [],
  h1: [],
  h2: [],
  h3: [],
  h4: [],
  h5: [],
  h6: [],
  i: [],
  img: ['src', 'alt', 'title', 'width', 'height'],
  li: [],
  ol: [],
  p: [],
  pre: [],
  s: [],
  small: [],
  span: [],
  sub: [],
  sup: [],
  strong: [],
  u: [],
  ul: []
}

He default ah hian value thar i dah duh chuan whiteLista hnuaia mi ang hian i ti thei ang:

var myDefaultWhiteList = $.fn.tooltip.Constructor.DEFAULTS.whiteList

// To allow table elements
myDefaultWhiteList.table = []

// To allow td elements and data-option attributes on td elements
myDefaultWhiteList.td = ['data-option']

// You can push your custom regex to validate your attributes.
// Be careful about your regular expressions being too lax
var myCustomRegex = /^data-my-app-[\w-]+/
myDefaultWhiteList['*'].push(myCustomRegex)

Library bik hman i duh avangin kan sanitizer hi bypass i duh a nih chuan, entirnan DOMPurify , a hnuaia mi ang hian i ti tur a ni:

$('#yourTooltip').tooltip({
  sanitizeFn: function (content) {
    return DOMPurify.sanitize(content)
  }
})

Browser te pawh a awm lodocument.implementation.createHTMLDocument

Browser support lo a nih chuan document.implementation.createHTMLDocument, Internet Explorer 8 ang chi, built-in sanitize function chuan HTML chu a awm ang angin a rawn pe leh thin.

Hetiang a nih chuan sanitization tih i duh chuan DOMPurifysanitizeFn ang chi external library kha specify la, hmang rawh .

Version number te pawh a awm

Bootstrap-a jQuery plugin pakhat zel version chu VERSIONplugin constructor property hmangin a lut thei a ni. Entirnan, tooltip plugin atan chuan:

$.fn.tooltip.Constructor.VERSION // => "3.4.1"

JavaScript tihtawp a nih chuan special fallback a awm lo

Bootstrap-a plugins te hi JavaScript tihtawp a nih chuan a bik takin grace takin an tla leh lo. Hetiang a nih avang hian user experience i ngaih pawimawh a nih chuan, i user-te <noscript>hnena thil awmdan (leh JavaScript re-enable dan tur) hrilhfiah nan hmang la, leh/ emaw, nangmah ngeiin i custom fallback te pawh add rawh.

Third-party library te pawh a awm bawk

Bootstrap hian official takin third-party JavaScript library Prototype emaw jQuery UI ang chi a support lo. Despite .noConflictleh namespaced events, compatibility problem a awm thei a, chu chu nangmah ngeiin i siam that a ngai a ni.

Transition te chu transition.js a ni

Transition chungchang

Transition effect awlsam tak tak atan chuan transition.jsJS file dangte bulah vawi khat dah tel bawk ang che. Compiled (or minified) i hmang a nih chuan bootstrap.jshei hi dah tel a ngai lo—a awm tawh.

A chhunga awm chu

Transition.js hi event hrang hrang atana puitu bulpui ber a transitionEndnih bakah CSS transition emulator a ni bawk. Plugin dangte chuan CSS transition support a awm leh awm loh enfiah nan leh hanging transition man nan an hmang thin.

Transition te tihtawp

A hnuaia JavaScript snippet hmang hian transition te chu globally disable theih a ni a, chu chu transition.js(or bootstrap.jsor bootstrap.min.js, a nih dan azirin) load hnuah a lo thleng tur a ni:

$.support.transition = false

Modal te chu modal.js a ni

Modal te hi streamlined, mahse flexible, dialog prompts a awm a, functionality mamawh tlem ber leh smart defaults te a awm bawk.

Open modal tam tak a support lo

Modal dang a la hmuh theih laiin hawn loh tur a ni. Vawi khata modal pakhat aia tam lantir tur chuan custom code a ngai a ni.

Modal markup dahna tur a ni

Modal pakhat HTML code chu i document-ah top-level position-ah dah tum fo ang che, chutiang chuan component dangin modal hmel leh/ emaw functionality a nghawng loh nan.

Mobile device hmanga hriattirna

Mobile device-a modal hman chungchangah hian caveat thenkhat a awm. A chipchiar zawkna chu kan browser support docs ah hian en rawh .

HTML5 hian a semantics a sawifiah dan avang hian autofocusHTML attribute hian Bootstrap modal-ah nghawng a nei lo. Chutiang bawka effect nei tur chuan custom JavaScript thenkhat hmang la:

$('#myModal').on('shown.bs.modal', function () {
  $('#myInput').focus()
})

Entirna te

Static entirnan

Footer-a header, body leh action set awmna rendered modal.

<div class="modal fade" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
        <p>One fine body&hellip;</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

Live demo a ni ang

JavaScript hmangin modal pakhat toggle la, a hnuaia button hi click la. A hnuai lamah a slide ang a, page chunglam atang chuan a fade in ang.

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

Modal te chu hman theih turin siam rawh

Modal title, to , leh amah ngei pawh reference-in leh , add ngei role="dialog"ang che .aria-labelledby="...".modalrole="document".modal-dialog

Tin, i modal dialog chungchang sawifiahna chu aria-describedbyon hmangin i pe thei .modalbawk.

YouTube video te embedding a ni

YouTube video te chu modal-a embede tur chuan Bootstrap-a awm lo JavaScript dang a ngai a, chu chuan playback chu automatic-in a titawp thei a, thil dang tam tak a titawp thei bawk. Hrechiang duh tan he Stack Overflow post \angkai tak hi en la .

A duh duh size te pawh a awm bawk

Modal hian optional size pahnih a nei a, modifier class kaltlangin a .modal-dialog.

<!-- Large modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>

<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      ...
    </div>
  </div>
</div>

<!-- Small modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button>

<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      ...
    </div>
  </div>
</div>

Animation chu paih chhuak rawh

En tur fade in ai chuan modal lang mai mai tur tan chuan .fadei modal markup atang khan class kha paih chhuak rawh.

<div class="modal" tabindex="-1" role="dialog" aria-labelledby="...">
  ...
</div>

Grid system hmangin

Modal chhunga Bootstrap grid system hman tangkai tur chuan .rows chhungah nest mai .modal-bodyla, chutah chuan normal grid system class te hmang rawh.

<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="gridSystemModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        <div class="row">
          <div class="col-md-4">.col-md-4</div>
          <div class="col-md-4 col-md-offset-4">.col-md-4 .col-md-offset-4</div>
        </div>
        <div class="row">
          <div class="col-md-3 col-md-offset-3">.col-md-3 .col-md-offset-3</div>
          <div class="col-md-2 col-md-offset-4">.col-md-2 .col-md-offset-4</div>
        </div>
        <div class="row">
          <div class="col-md-6 col-md-offset-3">.col-md-6 .col-md-offset-3</div>
        </div>
        <div class="row">
          <div class="col-sm-9">
            Level 1: .col-sm-9
            <div class="row">
              <div class="col-xs-8 col-sm-6">
                Level 2: .col-xs-8 .col-sm-6
              </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" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

Modal inang vek trigger vek, content hrang hrang tlemte chauh nei, button bunch khat i nei em? Use event.relatedTargetleh HTML data-*attributes ( jQuery kaltlangin pawh ni thei ) hmangin modal chhunga thu awmte chu eng button nge i click tih a zirin a danglam thei. relatedTarget, chungchang chipchiar zawka hriat duh chuan Modal Events docs en rawh.

...button dang pawh a awm...
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Open modal for @mdo</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@fat">Open modal for @fat</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@getbootstrap">Open modal for @getbootstrap</button>
...more buttons...

<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="exampleModalLabel">New message</h4>
      </div>
      <div class="modal-body">
        <form>
          <div class="form-group">
            <label for="recipient-name" class="control-label">Recipient:</label>
            <input type="text" class="form-control" id="recipient-name">
          </div>
          <div class="form-group">
            <label for="message-text" class="control-label">Message:</label>
            <textarea class="form-control" id="message-text"></textarea>
          </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Send message</button>
      </div>
    </div>
  </div>
</div>
$('#exampleModal').on('show.bs.modal', function (event) {
  var button = $(event.relatedTarget) // Button that triggered the modal
  var recipient = button.data('whatever') // Extract info from data-* attributes
  // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
  // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
  var modal = $(this)
  modal.find('.modal-title').text('New message to ' + recipient)
  modal.find('.modal-body input').val(recipient)
})

Hman dan tur

Modal plugin hian i thup thup chu a mamawh angin a toggle a, data attribute emaw JavaScript hmangin a toggle thei bawk. .modal-openTin , <body>to override default scrolling behavior ah a dah belh bawk a .modal-backdrop, modal pawn lama click hunah shown modals dismiss theihna tur click area a siam bawk.

Data attribute hmangin a ni

JavaScript ziak lovin modal pakhat activate rawh. data-toggle="modal"Controller element, button ang chi, a data-target="#foo"or href="#foo"toggle tur modal bik target tur nen set rawh .

<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>

JavaScript hmangin

myModalJavaScript line khata id nei modal chu ko rawh :

$('#myModal').modal(options)

Thil thlan theih a ni

Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-backdrop="".

Hming lampang hlawhchhamna hrilhfiahna
backdrop a ni boolean emaw a string emaw a ni'static' dik Modal-backdrop element a awm bawk. staticA nih loh leh, click-a modal khar lo backdrop atan specify bawk ang che.
keyboard hmangin a ziak a boolean a ni dik Escape key i hmet chuan modal a khar thin
lantir boolean a ni dik Initialized hunah modal a lantir.
hla kawng diklo

He option hi v3.3.0 atang khan hman tawh loh a ni a, v4 ah pawh tihbo a ni tawh bawk. Chu ai chuan client-side templating emaw data binding framework emaw hmang la, jQuery.load chu nangmah ngeiin koh kan rawt zawk a ni.

Remote URL pek a nih chuan jQuery’s method hmangin content vawi khat load a ni ang a , div load-ah inject a ni ang. .modal-contentData-api i hman chuan a danglamna chu hrefattribute hmangin remote source i tarlang thei bawk. Chumi entirnan a hnuaia mi ang hian tarlan a ni:

<a data-toggle="modal" href="remote.html" data-target="#modal">Click me</a>

Thiltih dan tur

I content chu modal angin a activate thin. A pawm a, optional options a awm objectbawk .

$('#myModal').modal({
  keyboard: false
})

Modal pakhat chu manual in a toggle thin. Modal a lan tak tak emaw a thup hma emaw (chu chu shown.bs.modalor hidden.bs.modalevent a thlen hma) caller hnenah a kir leh thin.

$('#myModal').modal('toggle')

Manual takin modal a hawng thin. Modal a lan tak takshown.bs.modal hmain (chu chu event a thlen hmain ) caller hnenah a kir leh thin.

$('#myModal').modal('show')

Manual takin modal a thup thin. Modal chu thup tak tak a nihhidden.bs.modal hmain (chu chu event a thlen hmain ) caller hnenah a kir leh thin.

$('#myModal').modal('hide')

Scrollbar pakhat a lo lang a nih chuan counter turin modal positioning a siam tha leh a, chu chuan modal chu veilamah a zuang thla ang.

Modal hawn laiin a san zawng a inthlak hunah chauh mamawh a ni.

$('#myModal').modal('handleUpdate')

Thil thlengte

Bootstrap-a modal class hian modal functionality-a hooking-na tur event tlemte a pholang a ni.

Modal event zawng zawng hi modal ngeiah (ie at the <div class="modal">).

Thil thleng chi hrang hrang Hrilhfiahna
show.bs.modal a ni showHe event hi instance method kan koh chuan a fire nghal vek a ni. Click avanga lo awm a nih chuan click element chu relatedTargetevent property atan a awm thei.
tih a ni.bs.modal He event hi modal chu user hmuh theiha siam a nih hunah fire a ni (CSS transition zawh hun a nghak ang). Click avanga lo awm a nih chuan click element chu relatedTargetevent property atan a awm thei.
thup.bs.modal a ni hideHe event hi instance method koh a nih chuan a fire nghal a ni.
thup.bs.modal tih a ni He event hi modal chu user hnen atanga thup a nih zawh chuan a fire thin (CSS transitions zawh hun a nghak ang).
load a ni.bs.modal a ni He event hi modal in remoteoption hmanga content a load tawh chuan a fire thin.
$('#myModal').on('hidden.bs.modal', function (e) {
  // do something...
})

Dropdown te chu dropdown.js ah a awm

He plugin awlsam tak hmang hian engkim deuhthaw-ah dropdown menu dah belh la, navbar, tabs, leh pills te pawh a tel.

Navbar pakhat chhungah

Pills chhungah

.openData attribute emaw JavaScript hmangin dropdown plugin hian parent list item-a class toggle-in thup (dropdown menu) a toggle a ni.

Mobile device-ah chuan dropdown hawn hian .dropdown-backdropmenu pawn lama tap i tih hunah dropdown menu khar theihna tur tap area angin a dah belh a, hei hi iOS support dik tak neih a ngai a ni. Hei hian a awmzia chu open dropdown menu atanga dropdown menu dang a switch tur chuan mobile ah extra tap a ngai tihna a ni.

Note: data-toggle="dropdown"Attribute hi application level-a dropdown menu khar nan rintlak a nih avangin hman reng a tha.

Data attribute hmangin a ni

data-toggle="dropdown"Link emaw button emaw ah dah la , dropdown toggle rawh.

<div class="dropdown">
  <button id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown trigger
    <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" aria-labelledby="dLabel">
    ...
  </ul>
</div>

Link button hmanga URL te chu a awm reng theih nan , data-targettih aiah attribute hmang la href="#".

<div class="dropdown">
  <a id="dLabel" data-target="#" href="http://example.com/" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
    Dropdown trigger
    <span class="caret"></span>
  </a>

  <ul class="dropdown-menu" aria-labelledby="dLabel">
    ...
  </ul>
</div>

JavaScript hmangin

JavaScript hmangin dropdown te chu call la:

$('.dropdown-toggle').dropdown()

data-toggle="dropdown"a la mamawh reng a ni

JavaScript hmanga i dropdown i call emaw, a aiah data-api hmang emaw pawh nise, data-toggle="dropdown"dropdown-a trigger element-ah hian awm reng a ngai a ni.

Pakhatmah

Navbar emaw tabbed navigation pek tawh dropdown menu chu a toggle thin.

Dropdown event zawng zawng chu .dropdown-menu's parent element ah fire vek a ni.

Dropdown event zawng zawng hian relatedTargetproperty an nei vek a, a value chu toggling anchor element a ni.

Thil thleng chi hrang hrang Hrilhfiahna
show.bs.chu chu a rawn lang leh ta He event hi show instance method a koh chuan a fire nghal vek a ni.
tih a ni.bs.dropdown He event hi dropdown chu user hmuh theiha siam a nih chuan a fire thin (CSS transition a nghak ang, a zawh theih nan).
hide.bs.chu chu a rawn lang leh ta He event hi hide instance method koh a nih chuan a fire nghal a ni.
thup.bs.dropdown a ni He event hi dropdown chu user hnen atanga thup a nih zawh chuan a fire thin (CSS transitions a nghak ang, a zawh theih nan).
$('#myDropdown').on('show.bs.dropdown', function () {
  // do something…
})

ScrollSpy ah hian a awm a

Entirnan navbar ah

ScrollSpy plugin hi scroll position a zirin nav target te automatic a update theihna tur a ni. Navbar hnuaia area chu scroll la, active class inthlak dan chu en rawh. Dropdown sub items te pawh a highlight ang.

@thau

A rilru a buai em em a, a rilru a hah em em bawk a. Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi an hralh chhuah hma qui. Tumblr farm-to-table bicycle dikna eng pawh ni se. Anim keffiyeh chuan carles cardigan a ti a. Velit seitan mcsweeney thlalak booth 3 savawm thla irure. A rilru a buai em em a, a rilru a hah em em bawk a, a rilru a buai em em bawk a, a rilru a hah em em bawk a, a rilru a hah em em bawk a, a rilru a hah em em bawk a. et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh kut hnathawktu ullamco consequat.

@mdo a ni

Veniam marfa hmul nei skateboard, adipisicing fugiat velit pitchfork hmul. A rilru a buai em em a, a rilru a hah em em bawk a. mcsweeney's vero. Cupidatat pali loko nisi, ea helvetica nulla carles. Tattoo nei cosby sweater ei tur phur truck, mcsweeney-a quis non freegan vinyl a ni. Lo-fi wes anderson +1 chuan a rawn ti a. A rilru a buai em em a, a rilru a hah em em bawk a. Carles non aesthetic exercise quis gentrify. Brooklyn adipisicing kutchhuak beer vice keytar deserunt a ni.

pakhat

Occaecat commodo a ni a, a hring dup bawk. A rilru a buai em em a, a rilru a hah em em bawk a. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore pakhat chauh awmna coffee in magna veniam. Nunna sang id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS chuan a ti a. A rilru a buai em em a, a rilru a hah em em bawk a. DiY minim messenger bag. A rilru a hah lutuk chuan a rilru a buai em em a, a rilru a hah lutuk chuan a rilru a buai em em bawk a. fanny pack iphone.

pahnih

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 eng pawh delectus ei tur phur truck. A rilru a buai em em a, a rilru a hah em em bawk a. id assumenda. Locavore sed helvetica cliche irony, thundercats te hi i hre lo mai thei consequat hoodie gluten-free lo-fi fap aliquip. Laboure elit placeat an hralh zawh hmain, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan siam fel vek velit a ni. VHS chambray laboris hun rei lote chhunga hman theih a ni. A rilru a buai em em a, a rilru a hah em em bawk a.

Hman dan tur

Bootstrap nav a ngai a ni

Tunah hian Scrollspy hian active links te highlight tha tak neih nan Bootstrap nav component hman a ngai a ni.

ID target chinfel theih a ngai

Navbar link ah hian resolvable id target a awm tur a ni. Entirnan, a <a href="#home">home</a>chu DOM-a thil awm ang chi nen a inmil tur a <div id="home"></div>ni.

Non- :visibletarget element te chu ngaihthah a ni

:visiblejQuery ang lo target element te chu ngaihthah a ni ang a, an inmil nav item te chu highlight a ni ngai lovang.

Relative positioning a ngai a ni

Implementation method eng pawh ni se, scrollspy hian position: relative;i spying element-ah hman a ngai a ni. A tam zawkah chuan hei hi a <body>ni . , tih loh element dang scrollspying i tih hian set nei la, apply <body>ngei ngei tur a ni.heightoverflow-y: scroll;

Data attribute hmangin a ni

I topbar navigation-a awlsam taka scrollspy behavior dah belh data-spy="scroll"tur chuan, i spy duh element-ah dah la (most typically this would be the <body>). Tichuan Bootstrap component data-targeteng pawha parent element ID emaw class emaw nen attribute chu add ang che..nav

body {
  position: relative;
}
<body data-spy="scroll" data-target="#navbar-example">
  ...
  <div id="navbar-example">
    <ul class="nav nav-tabs" role="tablist">
      ...
    </ul>
  </div>
  ...
</body>

JavaScript hmangin

I CSS i dah hnuah position: relative;JavaScript hmangin scrollspy chu ko rawh:

$('body').scrollspy({ target: '#navbar-example' })

Thiltih dan tur

.scrollspy('refresh')

DOM atanga elements dah belh emaw paih emaw nena inzawma scrollspy hman hian refresh method chu hetiang hian i ko a ngai ang:

$('[data-spy="scroll"]').each(function () {
  var $spy = $(this).scrollspy('refresh')
})

Thil thlan theih a ni

Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-offset="".

Hming lampang hlawhchhamna hrilhfiahna
offset a ni a zat 10 a ni Scroll awmna tur chhut hunah chunglam atanga offset tur pixels.

Thil thlengte

Thil thleng chi hrang hrang Hrilhfiahna
activate rawh.bs.scrollspy tih hi a ni He event hi scrollspy-in item thar a activate apiangin a fire thin.
$('#myScrollspy').on('activate.bs.scrollspy', function () {
  // do something…
})

Tabs thlak theih tab.js

Entirna tabs te

Local content pane hmanga transition-ah tab functionality rang tak, chak tak dah belh la, dropdown menu hmang pawhin. Nested tab te hi a support lo.

Raw denim i la hre lo mai thei jean shorts Austin. A rilru a hah lutuk chuan a rilru a buai em em a, a rilru a hah lutuk chuan a rilru a buai em em bawk a. Retro synth master cleanse. A rilru a hah lutuk chuan a rilru a buai em em a, a rilru a hah lutuk chuan a rilru a buai em em bawk a. A rilru a buai em em a, a rilru a hah em em bawk a. dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid a ni a, a man pawh a tlawm hle. A rilru a buai em em a, a rilru a hah em em bawk a. salvia cillum iphone. Seitan aliquip quis cardigan american thawmhnaw, sa thattu 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.

Tabbed navigation a tizau

He plugin hian tabbed navigation component chu a tizau a, tabbable area a dah belh bawk.

Hman dan tur

JavaScript hmangin tabbable tab te chu enable rawh (tab tinte chu a hranin activate a ngai a ni):

$('#myTabs a').click(function (e) {
  e.preventDefault()
  $(this).tab('show')
})

Tab hrang hrangte chu kawng hrang hrangin i activate thei ang:

$('#myTabs a[href="#profile"]').tab('show') // Select tab by name
$('#myTabs a:first').tab('show') // Select first tab
$('#myTabs a:last').tab('show') // Select last tab
$('#myTabs li:eq(2) a').tab('show') // Select third tab (0-indexed)

Markup a ni

JavaScript engmah ziak lovin tab emaw pill navigation emaw chu element pakhat specify data-toggle="tab"emaw on emaw mai mai hmangin i activate thei a ni. Tab ah and class te data-toggle="pill"add chuan Bootstrap tab styling a apply ang a , and class te add chuan pill styling a apply bawk ang .navnav-tabsulnavnav-pills

<div>

  <!-- Nav tabs -->
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
    <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
    <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
    <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="home">...</div>
    <div role="tabpanel" class="tab-pane" id="profile">...</div>
    <div role="tabpanel" class="tab-pane" id="messages">...</div>
    <div role="tabpanel" class="tab-pane" id="settings">...</div>
  </div>

</div>

Fade effect a awm bawk

Tabs fade in siam tur chuan, pakhat zel ah add .faderawh .tab-pane. Tab pane hmasa ber pawhin .ina bul tanna thu awm chu hmuh theih turin a siam a ngai bawk.

<div class="tab-content">
  <div role="tabpanel" class="tab-pane fade in active" id="home">...</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>

Thiltih dan tur

$().tab

Tab element leh content container pakhat a activate thin. Tab hian DOM ah container node targeting a data-targetemaw a nei tur a ni. hrefA chunga entirnan kan tarlan te hi tab te hi attribute <a>nei s te an ni.data-toggle="tab"

.tab('show')

Tab pek chu thlang la, a kaihhnawih thu awmte chu a rawn tarlang ang. A hmaa tab dang thlan tawh zawng zawng chu thlan loh a ni a, a kaihhnawih thu awmte chu a thup vek a ni. Tab pane a lan tak takshown.bs.tab hmain (chu chu event a thlen hmain ) caller hnenah a kir leh thin.

$('#someTab').tab('show')

Thil thlengte

Tab thar kan lantir hian events te chu a hnuaia mi ang hian a rawn fire thin:

  1. hide.bs.tab(tuna active tab-ah hian)
  2. show.bs.tab(to-be-shown tab-ah chuan)
  3. hidden.bs.tab(active tab hmasaah khan hide.bs.tabevent atana hman ang chiah kha)
  4. shown.bs.tab(active thar-a just-shown tab-ah chuan, show.bs.tabevent atana hman ang chiah kha)

Tab active tawh loh chuan hide.bs.taband hidden.bs.tabevents chu a fire dawn lo.

Thil thleng chi hrang hrang Hrilhfiahna
show.bs.tab ah hian a awm He event hi tab show-ah a fire a, mahse tab thar a lan hmain a fire thin. Active tab leh a hmaa active tab (a awm chuan) te target turin event.targetand hmang ang che .event.relatedTarget
tih a ni.bs.tab He event hi tab pakhat a lan hnuah tab show ah a fire thin. Active tab leh a hmaa active tab (a awm chuan) te target turin event.targetand hmang ang che .event.relatedTarget
hide.bs.tab ah hian a awm He event hi tab thar entir tur a nih hunah a fire thin (chutiang chuan a hmaa active tab kha thup tur a ni). Tuna active tab leh soon-to-be-active tab thar chu target turin event.targetand hmang ang che .event.relatedTarget
thup.bs.tab ah hian a awm He event hi tab thar a lan hnuah a fire a (chutiang chuan a hmaa active tab kha a thup a ni). Active tab hmasa leh active tab thar target turin event.targetand hmang ang che .event.relatedTarget
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  e.target // newly activated tab
  e.relatedTarget // previous active tab
})

Hmanraw hman dan tur tooltip.js

Jason Frame ziah jQuery.tipsy plugin tha tak atanga infuih thar; Tooltips hi updated version a ni a, image-ah a innghat lo va, animation atan CSS3 a hmang a, local title storage atan data-attribute a hmang bawk.

Zero-length title nei tooltip te hi a lang ngai lo.

Entirna te

A hnuaia link te hi hover la, tooltips i hmu ang:

Tight pants next level keffiyeh i la hre lo ngei ang. Thlalak booth hmul raw denim letterpress vegan palai bag stumptown. Farm-to-table seitan, mcsweeney-a fixie sustainable quinoa 8-bit american apparel te chuan terry richardson vinyl chambray an nei a, an thil siam chu an hlim hle. Beard stumptown, cardigans banh mi lomo zing khawvar. Tofu biodiesel williamsburg marfa, pali loko mcsweeney chuan vegan chambray a tifai a. A really ironic artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral a ni.

Static hmanrua tip

Option pali a awm a, chunglam, dinglam, hnuai lam, leh veilam aligned te an ni.

Kawng pali

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>

Opt-in theihna a awm bawk

Performance avang hian Tooltip leh Popover data-apis te hi opt-in a ni a, chu chu nangmah ngeiin i initialize tur tihna a ni .

Page pakhata tooltip zawng zawng initialize dan pakhat chu an data-toggleattribute hmanga thlan hi a ni ang:

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})

Hman dan tur

Tooltip plugin hian content leh markup on demand a siam a, default-in tooltip te chu an trigger element hnuaiah a dah thin.

JavaScript hmangin tooltip chu trigger la:

$('#example').tooltip(options)

Markup a ni

Tooltip atana markup mamawh chu dataattribute chauh a ni a title, HTML element-ah chuan tooltip neih i duh a ni. Tooltip pakhata markup siam chu a awlsam deuh a, mahse position (by default-ah topchuan plugin-in a set) a ngai a ni.

<!-- HTML to write -->
<a href="#" data-toggle="tooltip" title="Some tooltip text!">Hover over me</a>

<!-- Generated markup by the plugin -->
<div class="tooltip top" role="tooltip">
  <div class="tooltip-arrow"></div>
  <div class="tooltip-inner">
    Some tooltip text!
  </div>
</div>

Line hrang hranga link a awm

A châng chuan line tam tak wrap thei hyperlink-ah tooltip i dah duh ṭhin. Tooltip plugin default behavior chu horizontal leh vertical-a center-a dah a ni. white-space: nowrap;Hei hi pumpelh nan i anchor-ah te dah belh rawh .

Button group, input group, leh table-a hmanrua dah tur hian setting bik a ngai a ni

.btn-groupa emaw an chhunga element-te chunga tooltips i hman hunah .input-groupemaw, table-a inzawm element-te ( <td>, <th>, <tr>, <thead>, <tbody>, <tfoot>)-ah emaw, container: 'body'duh loh side effects (element zau zawk leh/ emaw, tooltip trigger a nih hunah a rounded corners hloh emaw).

Hidden elements chungchangah tooltips entir tum suh

$(...).tooltip('show')Target element a nih laiin invoking display: none;hian tooltip chu a awmna tur dik lo takin a awm ang.

Keyboard leh assistive technology hmangtute tan hman theih tur tooltips

Keyboard hmanga navigate hmangtute tan, a bik takin assistive technology hmangtute tan chuan keyboard-focusable element link, form control, emaw tabindex="0"attribute nei element duh duh apiangah tooltips chauh i dah tur a ni.

Disabled elements chungchanga Tooltips hian wrapper elements a mamawh a ni

disableda or .disabledelement ah tooltip dah tur chuan element chu a chhungah dah la, chutah <div>chuan tooltip chu apply <div>zawk rawh.

Thil thlan theih a ni

Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-animation="".

Security avang hian sanitize, sanitizeFnleh whiteListoption te chu data attribute hmangin supply theih a ni lo tih hre reng ang che.

Hming Lampang Hlawhchhamna Hrilhfiahna
animation tih a ni boolean a ni dik Tooltip ah CSS fade transition hmangin apply rawh
container a ni string | diklo diklo

Tooltip chu element bik pakhatah a append thin. Entirnan: container: 'body'. He option hi a bik takin a tangkai hle a, document flow-ah tooltip chu triggering element bulah dah theih a ni - chu chuan window resize laiin tooltip chu triggering element atanga hla taka a float loh nan a veng ang.

titlai number | thil 0 a ni

Tooltip (ms) entir leh thup hun sawn hlat - manual trigger type-ah chuan a hman theih loh

Number supply a nih chuan hide/show pahnih ah delay a awm vek a ni

Thil awm dan tur chu:delay: { "show": 500, "hide": 100 }

html tih a ni boolean a ni diklo Tooltip ah HTML dah la. False a nih chuan jQuery-a textmethod hmangin DOM-ah content dah a ni ang. XSS attack i ngaihtuah chuan text hmang rawh.
dahna tur hmun a ni string | thiltih 'chung'

Tooltip dah dan tur - top | hnuai lam | veilam | dik tak | auto a ni.
"Auto" tih a nih chuan tooltip chu dynamically in a reorient ang. Entirnan, placement chu "auto left" a nih chuan tooltip chu a theih chuan veilamah a rawn lang ang a, chuti lo chuan ding lamah a rawn lang ang.

Function pakhat chu placement hriat nan hman a nih chuan tooltip DOM node chu a argument hmasa ber atan leh triggering element DOM node chu a pahnihna atan hmangin koh a ni. Context chu thistooltip instance ah dah a ni.

selector a ni hrui diklo Selector pek a nih chuan tooltip object te chu target tarlan te hnenah delegate a ni ang. jQuery.onPractice-ah chuan hei hi dynamically added DOM elements ( support)-a tooltips hmanna atan pawh hman a ni. Hei hi leh entîrna thu hriat theihna en rawh .
template a ni hrui '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'

Tooltip siam huna hman tur HTML base rawh.

Tooltip's titlechu a inject ang a, .tooltip-inner.

.tooltip-arrowtooltip-a arrow a lo ni ta a ni.

Wrapper element pawn lam ber chuan .tooltipclass a nei tur a ni.

nihna string | thiltih '' tih a ni.

titleAttribute a awm loh chuan title value default a ni.

Function pek a nih chuan a thisreference set tooltip attached element-ah dahin koh a ni ang.

ti per hrui 'hover focus' tih a ni. Tooltip a trigger dan - | tih kha click la hover rawh | focus | kuta thawh. Trigger tam tak i pass thei a; space hmangin then hran rawh. manualtrigger dang nen pawh a inzawm thei lo.
en theihna hmun a ni string | thil awmze nei | thiltih { thlangtu: 'taksa', padding: 0 } .

Tooltip chu he element huam chhungah hian a dah a. Entirnan: viewport: '#viewport'or{ "selector": "#viewport", "padding": 0 }

Function pek a nih chuan a argument awmchhun atan triggering element DOM node hmangin koh a ni. Context chu thistooltip instance ah dah a ni.

sanitize tih a ni boolean a ni dik Sanitization hi enable emaw disable emaw theih a ni. Activated a nih chuan 'template', 'content'leh 'title'options te chu sanitized a ni ang.
whiteList a ni thil Default value a ni Object ah chuan attribute leh tag phalsak te a awm
tihthianghlimFn null | thiltih engmah lo Hetah hian mahni sanitize function i supply thei ang. Sanitization tih nan library bik hman i duh chuan hei hi a tangkai thei hle.

Tooltip hrang hrang atana data attribute te

Tooltip hrang hrang atana option hrang hrangte chu a dangin data attribute hmanga tarlan theih a ni a, a chunga kan sawi tawh ang khan.

Thiltih dan tur

$().tooltip(options)

Element collection pakhatah tooltip handler a attache thin.

.tooltip('show')

Element pakhat tooltip a pholang. Tooltip a lan tak tak hmain (chu chu shown.bs.tooltipevent a thlen hmain) caller hnenah a kir leh thin. Hei hi tooltip "manual" triggering anga ngaih a ni. Zero-length title nei tootip te hi a lang ngai lo.

$('#element').tooltip('show')

.tooltip('hide')

Element pakhat tooltip a thup thin. Tooltip a thup tak tak hmain (chu chu hidden.bs.tooltipevent a thlen hmain) caller hnenah a kir leh thin. Hei hi tooltip "manual" triggering anga ngaih a ni.

$('#element').tooltip('hide')

.tooltip('toggle')

Element pakhat tooltip a toggle thin. Tooltip a lan tak tak emaw a thup hma emaw (chu chu shown.bs.tooltipor hidden.bs.tooltipevent a thlen hma) caller hnenah a kir leh thin. Hei hi tooltip "manual" triggering anga ngaih a ni.

$('#element').tooltip('toggle')

.tooltip('destroy')

Element pakhat tooltip a thup a, a tichhia bawk. Delegation hmanga siam Tooltips ( option hmanga siamselector ) te chu descendant trigger elements ah pakhat zel tihchhiat theih a ni lo.

$('#element').tooltip('destroy')

Thil thlengte

Thil thleng chi hrang hrang Hrilhfiahna
show.bs.a hmanrua te chu entir rawh showHe event hi instance method kan koh chuan a fire nghal vek a ni.
tih a ni.bs.tooltip He event hi tooltip chu user-in a hmuh theiha siam a nih hunah a fire a ni (CSS transition zawh hun a nghak ang).
hide.bs.thil hman dan tur hideHe event hi instance method koh a nih chuan a fire nghal a ni.
thup.bs.thil hman dan tur He event hi tooltip chu user hnen atanga thup a nih zawh chuan a fire thin (CSS transitions zawh hun a nghak ang).
a rawn dah lut.bs.tooltip show.bs.tooltipHe event hi DOM-a tooltip template dah a nih hunah event zawhah fire a ni.
$('#myTooltip').on('hidden.bs.tooltip', function () {
  // do something…
})

Popovers chu popover.js a ni

Secondary information dahna tur element eng pawhah iPad-a awm ang chi content overlay te te te dah belh rawh.

Popovers title leh content pahnih zero-length a nih chuan a lang ngai lo.

Plugin a innghat a ni

Popovers hian Bootstrap version-ah tooltip plugin hi dah tel a ngai a ni.

Opt-in theihna a awm bawk

Performance avang hian Tooltip leh Popover data-apis te hi opt-in a ni a, chu chu nangmah ngeiin i initialize tur tihna a ni .

Page pakhata popover zawng zawng initialize dan pakhat chu an data-toggleattribute hmanga thlan hi a ni ang:

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

Button group, input group leh table-a popover-te hian setting bik a mamawh a ni

.btn-groupa emaw an chhunga element-te chunga popovers i hman hian .input-group, emaw, table-a inzawm element-te ( <td>, <th>, <tr>, <thead>, <tbody>, <tfoot>)-ah emaw, container: 'body'duh loh side effects (element zau zawk leh/ emaw, popover a trigger hunah a rounded corners hloh emaw).

Hidden elements-ah popovers lantir tum suh

$(...).popover('show')Target element a nih lai invoking display: none;hian popover chu a position dik lo ang.

Disabled element-a popover-ah chuan wrapper element a ngai a

disabledA emaw element emaw ah popover dah tur chuan a .disabledchhungah element dah la, chutah chuan <div>popover chu hnawih <div>zawk rawh.

Line hrang hranga link a awm

A châng chuan line tam tak wrap tu hyperlink-ah popover dah belh i duh ṭhin. Popover plugin default behavior chu horizontal leh vertical-a center-a dah a ni. white-space: nowrap;Hei hi pumpelh nan i anchor-ah te dah belh rawh .

Entirna te

Static popover a ni

Option pali a awm a, chunglam, dinglam, hnuai lam, leh veilam aligned te an ni.

Popover chunglam a ni

A rilru a buai em em a, a rilru a hah em em bawk a. Aenean eu leo ​​quam a ni. A rilru a hah lutuk chuan a rilru a buai em em a, a rilru a hah lutuk chuan a rilru a buai em em bawk a.

Popover a dik e

A rilru a buai em em a, a rilru a hah em em bawk a. Aenean eu leo ​​quam a ni. A rilru a hah lutuk chuan a rilru a buai em em a, a rilru a hah lutuk chuan a rilru a buai em em bawk a.

Popover hnuai lam

A rilru a buai em em a, a rilru a hah em em bawk a. Aenean eu leo ​​quam a ni. A rilru a hah lutuk chuan a rilru a buai em em a, a rilru a hah lutuk chuan a rilru a buai em em bawk a.

Popover chu a chhuak ta a

A rilru a buai em em a, a rilru a hah em em bawk a. Aenean eu leo ​​quam a ni. A rilru a hah lutuk chuan a rilru a buai em em a, a rilru a hah lutuk chuan a rilru a buai em em bawk a.

Live demo a ni ang

<button type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>

Kawng pali

<button type="button" class="btn btn-default" data-container="body" data-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="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
  Popover on top
</button>

<button type="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>

<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
  Popover on right
</button>

A hnuaia click leh hunah dismiss rawh

focusUser-in a click leh hunah popovers chu dismiss turin trigger hmang ang che .

Dismiss-on-next-click atan markup bik a ngai

Cross-browser leh cross-platform behavior dik tak neih theih nan tag ni lovin tag i hmang tur a ni a , <a>and attribute te pawh <button>i dah tel tur a ni.role="button"tabindex

<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>

Hman dan tur

JavaScript hmangin popovers te chu enable rawh:

$('#example').popover(options)

Thil thlan theih a ni

Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-animation="".

Security avang hian sanitize, sanitizeFnleh whiteListoption te chu data attribute hmangin supply theih a ni lo tih hre reng ang che.

Hming Lampang Hlawhchhamna Hrilhfiahna
animation tih a ni boolean a ni dik Popover ah hian CSS fade transition hmangin apply rawh
container a ni string | diklo diklo

Popover chu element bik pakhatah a append thin. Entirnan: container: 'body'. He option hi a bik takin a tangkai hle a, triggering element bulah document flow-ah popover chu dah theih a ni - chu chuan window resize laiin popover chu triggering element atanga hla takah a float loh nan a veng ang.

lungawi string | thiltih '' tih a ni.

data-contentAttribute a awm loh chuan default content value a ni.

Function pek a nih chuan a thisreference set chu popover attached element-ah dahin a ko ang.

titlai number | thil 0 a ni

Popover (ms) entir leh thup hun sawn hlat - manual trigger type-ah chuan a hman theih loh

Number supply a nih chuan hide/show pahnih ah delay a awm vek a ni

Thil awm dan tur chu:delay: { "show": 500, "hide": 100 }

html tih a ni boolean a ni diklo Popover ah chuan HTML kha dah lut rawh. False a nih chuan jQuery-a textmethod hmangin DOM-ah content dah a ni ang. XSS attack i ngaihtuah chuan text hmang rawh.
dahna tur hmun a ni string | thiltih 'dik'

Popover dah dan tur - top | hnuai lam | veilam | dik tak | auto a ni.
"Auto" tih a nih chuan popover chu dynamically in a reorient ang. Entirnan, placement chu "auto left" a nih chuan a theih chuan popover chu veilamah a rawn lang ang a, chuti lo chuan ding lamah a rawn lang ang.

Function pakhat hmanga placement hriat chian a nih chuan popover DOM node chu a argument hmasa ber atan leh triggering element DOM node chu a pahnihna atan hmangin koh a ni. Context chu thispopover instance ah dah a ni.

selector a ni hrui diklo Selector pek a nih chuan popover objects chu target tarlan te hnenah delegate a ni ang. A taka hman chuan hei hi dynamic HTML content-a popovers dah theihna turin hman a ni. Hei hi leh entîrna thu hriat theihna en rawh .
template a ni hrui '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'

Popover siam huna hman tur HTML base rawh.

Popover's titlechu inject a ni ang a, .popover-title.

Popover's contentchu inject a ni ang a, .popover-content.

.arrowpopover-a thal a lo ni ta a ni.

Wrapper element pawn lam ber chuan .popoverclass a nei tur a ni.

nihna string | thiltih '' tih a ni.

titleAttribute a awm loh chuan title value default a ni.

Function pek a nih chuan a thisreference set chu popover attached element-ah dahin a ko ang.

ti per hrui 'click' a ti a. Popover a tihchhuah dan - | hover rawh | focus | kuta thawh. Trigger tam tak i pass thei a; space hmangin then hran rawh. manualtrigger dang nen pawh a inzawm thei lo.
en theihna hmun a ni string | thil awmze nei | thiltih { thlangtu: 'taksa', padding: 0 } .

Popover chu he element huam chhungah hian a vawng reng a ni. Entirnan: viewport: '#viewport'or{ "selector": "#viewport", "padding": 0 }

Function pek a nih chuan a argument awmchhun atan triggering element DOM node hmangin koh a ni. Context chu thispopover instance ah dah a ni.

sanitize tih a ni boolean a ni dik Sanitization hi enable emaw disable emaw theih a ni. Activated a nih chuan 'template', 'content'leh 'title'options te chu sanitized a ni ang.
whiteList a ni thil Default value a ni Object ah chuan attribute leh tag phalsak te a awm
tihthianghlimFn null | thiltih engmah lo Hetah hian mahni sanitize function i supply thei ang. Sanitization tih nan library bik hman i duh chuan hei hi a tangkai thei hle.

Mimal popovers te tan data attribute te

Mimal popover-te tana duhthlan tur chu a dangin data attribute hmanga tarlan theih a ni a, a chunga kan sawi tawh ang khan.

Thiltih dan tur

$().popover(options)

Element collection pakhat atan popovers a initialize thin.

.popover('show')

Element pakhat popover a nihzia a pholang. Popover a lan tak tak hmain (chu chu shown.bs.popoverevent a thlen hmain) caller hnenah a kir leh thin. Hei hi popover triggering "manual" anga ngaih a ni. Popovers title leh content pahnih zero-length a nih chuan a lang ngai lo.

$('#element').popover('show')

.popover('hide')

Element pakhat popover a thup. Popover chu thup tak tak a nih hmain (chu chu hidden.bs.popoverthilthleng a thlen hma) call tu hnenah a kir leh thin. Hei hi popover triggering "manual" anga ngaih a ni.

$('#element').popover('hide')

.popover('toggle')

Element pakhat popover a toggle thin. Popover a lan tak tak emaw a thup hma emaw (chu chu shown.bs.popoveror hidden.bs.popoverevent a thlen hma) caller hnenah a kir leh thin. Hei hi popover triggering "manual" anga ngaih a ni.

$('#element').popover('toggle')

.popover('destroy')

Element pakhat popover chu a thup a, a tichhe vek bawk. Delegation hmanga siam Popovers ( option hmanga siamselector ) te chu descendant trigger element-ah pakhat zel tihchhiat theih a ni lo.

$('#element').popover('destroy')

Thil thlengte

Thil thleng chi hrang hrang Hrilhfiahna
show.bs.popover tih hi a ni showHe event hi instance method kan koh chuan a fire nghal vek a ni.
a lantir.bs.popover He event hi popover chu user hmuh theiha siam a nih hunah fire a ni (CSS transitions zawh hun a nghak ang).
thup.bs.popover tih hi a ni hideHe event hi instance method koh a nih chuan a fire nghal a ni.
thup.bs.retheihna He event hi popover chu user hnen atanga thup a nih zawh chuan a fire thin (CSS transitions zawh hun a nghak ang).
a rawn dah lut.bs.popover show.bs.popoverHe event hi DOM-a popover template dah a nih hunah event zawhah fired a ni.
$('#myPopover').on('hidden.bs.popover', function () {
  // do something…
})

Alert thuchah alert.js

Entirna alerts te

He plugin hmang hian alert message zawng zawngah dismiss functionality add vek ang che.

Button hman hunah chuan a .closefa hmasa ber a ni tur a ni a .alert-dismissible, markup-ah chuan a hmaah text content a awm thei lo.

Hman dan tur

I close button ah khan add mai la data-dismiss="alert", automatic in alert close functionality a pe ang. Alert khar hian DOM atangin a paih chhuak thin.

<button type="button" class="close" data-dismiss="alert" aria-label="Close">
  <span aria-hidden="true">&times;</span>
</button>

I alerts te kha khar hunah animation hmang turin, an chungah .fadeleh .inclass te chu an apply tawh tih chian hmasa phawt ang che.

Thiltih dan tur

$().alert()

data-dismiss="alert"Attribute nei descendant element-a click event awmte chu alert ngaithla turin a siam . (Data-api-a auto-initialization hman hunah a ngai lo.)

$().alert('close')

DOM atanga alert lakchhuah hmangin a khar thin. Element -ah hian .fadeand .inclass a awm chuan alert chu a paih hmain a fade out ang.

Thil thlengte

Bootstrap-a alert plugin hian alert functionality-a hook theihna tur thil thleng tlemte a pholang a ni.

Thil thleng chi hrang hrang Hrilhfiahna
khar rawh.bs.alert a ni closeHe event hi instance method kan koh chuan a fire nghal vek a ni.
khar a ni.bs.alert He event hi alert khar a nih hunah fire a ni (CSS transition zawh hun a nghak ang).
$('#myAlert').on('closed.bs.alert', function () {
  // do something…
})

Buttons te chu a rawn lang a.js

Button hmangin tam zawk ti rawh. Control button state emaw toolbar ang chi component tam zawk tan button group siam emaw a ni.

Cross-browser hmanga hman theih a ni

Firefox hian page load zawng zawngah form control state (disabledness leh checkedness) a persist . Chumi atana workaround chu hman autocomplete="off"a ni . Mozilla bug #654072 ah hian en rawh .

Stateful tak a ni

data-loading-text="Loading..."Button pakhata loading state hman tur chuan add rawh .

He feature hi v3.3.5 atang khan hman tawh loh a ni a, v4 ah pawh paih a ni tawh bawk.

I duh ang state hmang rawh!

He demonstration atan hian leh , kan hmang data-loading-texta $().button('loading'), mahse chu chauh chu state i hman theih a ni lo. Hemi chungchang hi a hnuaia $().button(string)documentation ah hian en belh rawh .

<button type="button" id="myButton" data-loading-text="Loading..." class="btn btn-primary">
  Loading state
</button>

<script>
  $('#myButton').on('click', function () {
    var $btn = $(this).button('loading')
    // business logic...
    $btn.button('reset')
  })
</script>

Toggle pakhat chauh a awm

data-toggle="button"Button pakhata toggling activate turin Add rawh .

Pre-toggled buttons mamawh .activeleharia-pressed="true"

Pre-toggled button atan chuan .activeclass leh aria-pressed="true"attribute chu buttonyourself ah i dah tur a ni.

<button type="button" class="btn btn-primary" data-toggle="button" aria-pressed="false">
  Single toggle
</button>

Checkbox / Radio tih a ni

Containing checkbox emaw radio inputs ah te dah la data-toggle="buttons", .btn-groupanmahni style hrang hranga toggling theihna tur.

Preselected option te a ngai a ni.active

.activePreselected options atan chuan class chu input's ah labelnangmah ngeiin i add tur a ni.

Visual checked state chu click-ah chauh update a ni

Checkbox button checked state chu button click-a event fire lovin update a nih chuan (eg input-a property <input type="reset">setting via emaw via emaw ), input-a class chu nangmah ngeiin i toggle a ngai ang.checked.activelabel

<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-primary active">
    <input type="checkbox" checked> Checkbox 1 (pre-checked)
  </label>
  <label class="btn btn-primary">
    <input type="checkbox"> Checkbox 2
  </label>
  <label class="btn btn-primary">
    <input type="checkbox"> Checkbox 3
  </label>
</div>
<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-primary active">
    <input type="radio" name="options" id="option1" checked> Radio 1 (preselected)
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option2"> Radio 2
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option3"> Radio 3
  </label>
</div>

Thiltih dan tur

$().button('toggle')

Push state a tidanglam. Button chu a activate tawh ang maiin a lang.

$().button('reset')

Button state a reset - text chu original text ah a inthlak thin. He method hi asynchronous a ni a, resetting a zawh tak tak hmain a rawn kir leh thin.

$().button(string)

Data defined text state eng pawhah text a swap thin.

<button type="button" id="myStateButton" data-complete-text="finished!" class="btn btn-primary">
  ...
</button>

<script>
  $('#myStateButton').on('click', function () {
    $(this).button('complete') // button text will be "finished!"
  })
</script>

Collapse tih hi a ni.js

Flexible plugin hmangin class tlemte hmangin toggle behavior awlsam tak a awm thei.

Plugin a innghat a ni

Collapse hian i Bootstrap version ah transitions plugin kha dah tel a ngai a ni.

Entirna

A hnuaia button te hi click la, class thlak danglam hmangin element dang a lantir leh thup ang:

  • .collapsecontent a thup thin
  • .collapsingtransition neih laiin hman a ni
  • .collapse.inthupui a lantir

Attribute awmna link i hmang thei a href, attribute awmna button i hmang thei data-targetbawk. Heng pahnihah hian the data-toggle="collapse"is required.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
<a class="btn btn-primary" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
  Link with href
</a>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
  Button with data-target
</button>
<div class="collapse" id="collapseExample">
  <div class="well">
    ...
  </div>
</div>

Accordion entirnan

Panel component nen accordion siam turin default collapse behavior chu extend rawh.

A rilru a buai em em a, a rilru a hah em em bawk a, a rilru a buai em em bawk a, a rilru a hah em em bawk a, a rilru a hah em em bawk a. terry richardson ad squid. 3 savawm thla officia aute, non cupidatat skateboard dolor brunch hmanga siam a ni. Chaw phur truck quinoa nesciunt laborum eiusmod. Brunch 3 sava thla tempor, sunt aliqua chuan a chungah sava dah squid single-origin coffee nulla assumenda shoreditch et. A rilru a buai em em a, a rilru a hah em em bawk a, a rilru a buai em em bawk a, a rilru a hah em em bawk a. craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan tih loh chu sa thattu vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt i hre lo mai thei an accusamus labore sustainable VHS.
A rilru a buai em em a, a rilru a hah em em bawk a, a rilru a buai em em bawk a, a rilru a hah em em bawk a, a rilru a hah em em bawk a. terry richardson ad squid. 3 savawm thla officia aute, non cupidatat skateboard dolor brunch hmanga siam a ni. Chaw phur truck quinoa nesciunt laborum eiusmod. Brunch 3 sava thla tempor, sunt aliqua chuan a chungah sava dah squid single-origin coffee nulla assumenda shoreditch et. A rilru a buai em em a, a rilru a hah em em bawk a, a rilru a buai em em bawk a, a rilru a hah em em bawk a. craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan tih loh chu sa thattu vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt i hre lo mai thei an accusamus labore sustainable VHS.
A rilru a buai em em a, a rilru a hah em em bawk a, a rilru a buai em em bawk a, a rilru a hah em em bawk a, a rilru a hah em em bawk a. terry richardson ad squid. 3 savawm thla officia aute, non cupidatat skateboard dolor brunch hmanga siam a ni. Chaw phur truck quinoa nesciunt laborum eiusmod. Brunch 3 sava thla tempor, sunt aliqua chuan a chungah sava dah squid single-origin coffee nulla assumenda shoreditch et. A rilru a buai em em a, a rilru a hah em em bawk a, a rilru a buai em em bawk a, a rilru a hah em em bawk a. craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan tih loh chu sa thattu vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt i hre lo mai thei an accusamus labore sustainable VHS.
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingOne">
      <h4 class="panel-title">
        <a role="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" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
      <div class="panel-body">
        Anim pariatur cliche 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 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 class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingTwo">
      <h4 class="panel-title">
        <a class="collapsed" role="button" data-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-body">
        Anim pariatur cliche 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 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 class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingThree">
      <h4 class="panel-title">
        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </a>
      </h4>
    </div>
    <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
      <div class="panel-body">
        Anim pariatur cliche 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 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>

.panel-bodyTin , s leh s swap out theih a .list-groupni bawk.

  • Bootply a ni
  • Pakhat chu itmus ac facilin a ni
  • Pahnihna eros

Expand/collapse control te chu hman theih turin siam rawh

aria-expandedControl element ah hian add ngei ngei tur a ni. He attribute hian screen reader leh a ang chi assistive technology te hnena collapsible element dinhmun awm mek chu chiang takin a tarlang a ni. Collapsible element chu default-a khar a nih chuan value aria-expanded="false". inClass hmangin collapsible element chu default-a open turin i set tawh a nih chuan aria-expanded="true"control-ah set zawk rawh. Plugin hian collapsible element hawn leh khar a nih leh nih loh a zirin he attribute hi a toggle nghal vek ang.

Tin, i control element hian collapsible element pakhat a target a nih chuan – chu chu data-targetattribute chuan selector a kawhhmuh a nih chuan id– control element-ah attribute dang i dah belh thei bawk aria-controlsa, chutah chuan idof the collapsible element a awm bawk. Tunlai screen reader leh a ang chi assistive technology te chuan he attribute hi an hmang a, chu chuan a hmangtute chu collapsible element ngeia direct-a kal theihna tur shortcut dang a pe a ni.

Hman dan tur

Collapse plugin hian heavy lifting handle turin class tlemte a hmang a:

  • .collapsea thupui chu a thup thin
  • .collapse.ina thupui chu a entir a
  • .collapsingtransition a tan hunah a dah belh a, a zawh chuan a paih leh bawk

Heng class te hi component-animations.less.

Data attribute hmangin a ni

Element ah add data-toggle="collapse"leh a data-targettih mai la, collapsible element control chu automatic in a assign ang. Attribute hian data-targetcollapse apply tur CSS selector a pawm a. collapseCollapsible element ah hian class chu add ngei ngei tur a ni. Default open i duh chuan additional class kha add la in.

Collapsible control-a accordion ang chi group management dah belh tur chuan data attribute data-parent="#selector". Hei hi action-a hmuh theih nan demo en rawh.

JavaScript hmangin

Manual hmangin enable theih a ni:

$('.collapse').collapse()

Thil thlan theih a ni

Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-parent="".

Hming lampang hlawhchhamna hrilhfiahna
nu leh pa selector a ni diklo Selector pek a nih chuan he collapsible item hi a lan hunah parent tarlan hnuaia collapsible element zawng zawng chu khar vek a ni ang. panel(traditional accordion behavior nen a inang - hei hi class -ah a innghat )
toggle a ni boolean a ni dik Invocation-ah collapsible element a toggle thin

Thiltih dan tur

.collapse(options)

I content chu collapsible element angin a activate thin. A pawm a, optional options a awm objectbawk .

$('#myCollapsible').collapse({
  toggle: false
})

.collapse('toggle')

Collapsible element chu show emaw hidden emaw ah a toggle thin. Collapsible element chu a takin a lan hma emaw a thup hmain (chu chu shown.bs.collapseor hidden.bs.collapseevent a thlen hmain) caller hnenah a kir leh thin.

.collapse('show')

Collapsible element a lantir. Collapsible element a lan tak tak hmain (chu chu shown.bs.collapseevent a thlen hmain) caller hnenah a kir leh thin.

.collapse('hide')

Collapsible element a thup thei. Collapsible element chu thup tak tak a nih hmain (chu chu hidden.bs.collapseevent a thlen hmain) caller hnenah a kir leh thin.

Thil thlengte

Bootstrap-a collapse class hian collapse functionality-a hook theihna tur event tlemte a pholang a.

Thil thleng chi hrang hrang Hrilhfiahna
show.bs.collapse tih hi a ni showHe event hi instance method kan koh chuan a fire nghal vek a ni.
tih a ni.bs.collapse He event hi collapse element pakhat user hmuh theiha siam a nih chuan fired a ni (CSS transition zawh hun a nghak ang).
thup.bs.collapse tih hi a ni hideHe event hi method a koh zawh chuan a fire nghal a ni.
thup.bs.collapse tih a ni He event hi user hnen atanga collapse element thup a nih chuan fire a ni (CSS transition zawh hun a nghak ang).
$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something…
})

Carousel carousel.js a ni

Element hrang hranga cycle kal theihna tur slideshow component, carousel ang chi. Nested carousel te hi a support lo.

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="..." alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item">
      <img src="..." alt="...">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    ...
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

Optional caption te pawh a awm

I slide-ah awlsam takin caption dah la, .carousel-captionelement awmin any .item. Chutah chuan optional HTML eng pawh dah la, automatic in a align leh format ang.

<div class="item">
  <img src="..." alt="...">
  <div class="carousel-caption">
    <h3>...</h3>
    <p>...</p>
  </div>
</div>

Carousel tam tak a awm

Carousel - te chu carousel control-te a thawh that theih nan idon the outermost container (the ) hman a ngai a ni. .carouselCarousel tam tak i dah belh hunah, emaw, carousel pakhat i thlak hunah emaw, a idkaihhnawih controls te chu update ngei ang che.

Data attribute hmangin a ni

Data attribute hmangin awlsam takin carousel awmna tur control rawh. data-slidekeywords prevor next, chu a pawm a, chu chuan slide awmna chu a awmna hmun nen khaikhin chuan a thlak danglam a ni. A dang pawhin, data-slide-toraw slide index chu carousel-ah pass turin hmang la data-slide-to="2", chu chuan slide awmna chu index bik pakhatah a sawn a, chu chu 0.

data-ride="carousel"Attribute hi page load atanga tan carousel chu animating anga mark nan hman a ni . Carousel khata (redundant leh a tul lo) explicit JavaScript initialization nen hman dun theih a ni lo.

JavaScript hmangin

Carousel chu manual-in call la, hetiang hian:

$('.carousel').carousel()

Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-interval="".

Hming lampang hlawhchhamna hrilhfiahna
inkar a ni a zat 5000 a ni Item pakhat automatic-a cycle-a tihkhawtlai hun chhung. Dik lo a nih chuan carousel hian automatic in a cycle dawn lo.
chawl string | engmah lo "hover" tih a ni. A set a nih chuan "hover"carousel on cycling chu a pause a, carousel on mouseentercycling chu a chhunzawm leh mouseleaveang. -a dah a nih chuan nullcarousel chunga hovering hian a pause dawn lo.
tuam boolean a ni dik Carousel hian cycle chhunzawm zel tur nge hard stop neih tur tih.
keyboard hmangin a ziak a boolean a ni dik Keyboard thil thlengah carousel hian a chhan let tur em tih.

Carousel chu optional options hmangin a initialize a, objectitem hrang hrang hmangin cycle a kal tan thin.

$('.carousel').carousel({
  interval: 2000
})

Carousel thilte chu veilam atanga dinglam thlengin a cycle a.

Carousel chu thil kaltlangin cycle a kal theih loh nan a titawp.

Carousel chu frame pakhatah a cycle (0 based, array ang chi).

Item hmasa lam chu a cycle a.

Item dang lam pan chuan a cycle a.

Bootstrap-a carousel class hian carousel functionality-a hooking-na tur event pahnih a pholang a ni.

Event pahnih hian a hnuaia additional property te hi an nei vek a ni:

  • direction: Carousel a tlan chhuahna lam (either "left"or "right").
  • relatedTarget: Active item anga a hmuna slid tur DOM element.

Carousel event zawng zawng hi carousel ngeiah (ie at the <div class="carousel">).

Thil thleng chi hrang hrang Hrilhfiahna
slide.bs.carousel a ni He event hi slideinstance method invoke a nih chuan a fire nghal vek a ni.
slid.bs.carousel tih a ni He event hi carousel-in a slide transition a zawh hunah a kap thin.
$('#myCarousel').on('slide.bs.carousel', function () {
  // do something…
})

affix.js tih kha affix rawh

Entirna

Affix plugin position: fixed;hian on leh off a toggle a, position: sticky;. Dinglama subnavigation hi affix plugin live demo a ni.


Hman dan tur

Affix plugin hi data attribute hmangin emaw, mahni JavaScript hmangin manual-in emaw hmang ang che. Chutiang dinhmun pahnihah chuan i affixed content awmna tur leh a zau zawng tur CSS i pe tur a ni.

Note: Safari rendering bug avang hian affix plugin hi element awmna hmuna awm, pulled emaw pushed column ang chiah hmang suh

CSS hmanga dinhmun siam

Affix plugin hian class pathum a toggle a, pakhatin state bik a entir a: .affix, .affix-top, leh .affix-bottom. Heng class te tan hian style te chu i pe tur a ni a , position: fixed;on tih loh chu .affixnangmah ngeiin (he plugin atanga innghat lovin) position tak tak te chu i handle thei ang.

Affix plugin hnathawh dan chu hetiang hi a ni:

  1. A bul tan nan chuan plugin chuan a rawn dah belh leh ang.affix-top element chu a top-most position-ah a awm tih hriattir turin a belh a. Hetih lai hian CSS positioning a ngai lo.
  2. Affix duh element kal pelh chuan affixing tak tak chu a tichhuak tur a ni. Hei hi .affixreplace .affix-topleh set position: fixed;(Bootstrap’s CSS atanga pek) awmna hmun a ni.
  3. Bottom offset a define a nih chuan a kal pelh chuan a thlak tur .affixa .affix-bottomni. Offsets hi optional a nih avangin pakhat setting chuan CSS dik tak set a ngai a ni. Chutiang a nih position: absolute;chuan a tul hunah add tur a ni. Plugin hian data attribute emaw JavaScript option emaw hmangin chuta tang chuan element chu khawiah nge a dah tur tih a hriat theih a ni.

A chunga kan sawi ang hian i CSS chu a hnuaia usage option pahnih atan set rawh.

Data attribute hmangin a ni

data-spy="affix"Element eng pawha awlsam taka affix behavior dah tur chuan spy duh element ah khan add mai tur a ni. Element pakhat pinning toggle hun tur sawifiah nan offsets hmang ang che.

<div data-spy="affix" data-offset-top="60" data-offset-bottom="200">
  ...
</div>

JavaScript hmangin

JavaScript hmangin affix plugin chu call rawh:

$('#myAffix').affix({
  offset: {
    top: 100,
    bottom: function () {
      return (this.bottom = $('.footer').outerHeight(true))
    }
  }
})

Thil thlan theih a ni

Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-offset-top="200".

Hming lampang hlawhchhamna hrilhfiahna
offset a ni number | hnathawh | thil 10 a ni Scroll awmna tur chhiar hunah screen atanga offset tur pixels te. Number pakhat pek a nih chuan offset chu a chung leh a hnuai lam zawng zawngah hman a ni ang. Unique, bottom leh top offset pek tur chuan object offset: { top: 10 }emaw offset: { top: 10, bottom: 5 }. Offset pakhat dynamically calculate i mamawh hunah function hmang ang che.
tum bik thlangtu | node | jQuery element a ni thil windowawmzia chu Affix-a target element a tarlang.

Thiltih dan tur

.affix(options)

I content chu affixed content angin a activate thin. A pawm a, optional options a awm objectbawk .

$('#myAffix').affix({
  offset: 15
})

.affix('checkPosition')

Affix dinhmun chu a kaihhnawih element hrang hrangte dimension, position leh scroll position hmangin a chhut nawn leh thin. , .affix, .affix-topleh .affix-bottomclass te chu state thar ang zelin affixed content-ah dah emaw, paih emaw a ni. Hetiang method hi affixed content emaw target element emaw dimensions tihdanglam apiangin koh a ngai a, chu chu affixed content awmna dik tak a nih theih nan a ni.

$('#myAffix').affix('checkPosition')

Thil thlengte

Bootstrap-a affix plugin hian affix functionality-a hook theihna tur event tlemte a pholang a ni.

Thil thleng chi hrang hrang Hrilhfiahna
affix.bs.affix tih a ni He event hi element affix hmain a kap nghal vek a ni.
affix a ni.bs.affix tih a ni He event hi element affix a nih hnuah fire a ni.
affix-a chungah.bs.affix He event hi element chu affix-top a nih hmain a kap nghal vek a ni.
affix-a chung.bs.affix tih a ni He event hi element chu affix-top a nih hnuah fire a ni.
affix-a hnuai lam.bs.affix He event hi element chu affixed-bottom a nih hmain a kap nghal vek a ni.
affixed-a hnuai lam.bs.affix He event hi element chu affix-bottom a nih hnuah fire a ni.