Ɔvaviu fɔ di Baybul

Wan wan ɔ we dɛn dɔn kɔmpilayt

Plɔgin dɛn kin inklud wan wan (yuz Bootstrap in wan wan *.jsfayl dɛn), ɔ ɔl wan tɛm (yuz bootstrap.jsɔ di minified bootstrap.min.js).

Yuz di JavaSkript we dɛn dɔn kɔmpilayt

Ɔl tu bootstrap.jsɛn bootstrap.min.jsgɛt ɔl di plɔgin dɛn na wan fayl. Na wan nɔmɔ yu fɔ put insay.

Plugin dipɛnsin dɛn

Sɔm plɔgin dɛn ɛn CSS kɔmpɔnɛnt dɛn de dipen pan ɔda plɔgin dɛn. If yu put plɔgin dɛn wan bay wan, mek shɔ se yu chɛk fɔ dɛn dipɛnsin dɛn ya na di dɔkyumɛnt dɛn. Notis bak se ɔl di plɔgin dɛn dipen pan jQuery (dis min se jQuery fɔ de bifo di plɔgin fayl dɛn). Kɔnsul wibower.json fɔ si us vɛshɔn dɛn fɔ jQuery dɛn de sɔpɔt.

Data atribyut dɛn

Yu kin yuz ɔl di Bootstrap plɔgin dɛn jɔs tru di mak API we yu nɔ rayt wan layn na JavaSkript. Dis na Bootstrap in fɔs klas API ɛn i fɔ bi yu fɔs tin we yu fɔ tink bɔt we yu de yuz plɔgin.

Dat se, insay sɔm sityueshɔn dɛn i kin fayn fɔ ɔf dis wok. So, wi de gi bak di abiliti fɔ disable di data atribyut API bay we wi de unbind ɔl di ivintɛns dɛn na di dɔkyumɛnt nemspɛs wit data-api. Dis luk lɛk dis:

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

Ɔda we de fɔ du dat, fɔ tɔch wan patikyula plɔgin, jɔs put di plɔgin in nem as nemspɛs wit di data-api nemspɛs lɛk dis:

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

Na wan plɔgin nɔmɔ fɔ ɛni ɛlimɛnt we de yuz data atribyut dɛn

Nɔ yuz data atribyut frɔm bɔku plɔgin dɛn na di sem ɛlimɛnt. Fɔ ɛgzampul, wan bɔtin nɔ kin ebul fɔ gɛt tultip ɛn fɔ tɔgl wan modal. Fɔ du dis, yuz wan tin we dɛn kin yuz fɔ rap.

Programmetik API fɔ di wan dɛn we de wok

Wi biliv bak se yu fɔ ebul fɔ yuz ɔl di Bootstrap plɔgin dɛn jɔs tru di JavaSkript API. Ɔl di pɔblik API dɛn na wan, chenj we dɛn kin yuz fɔ du tin, ɛn dɛn kin gi bak di kɔleshiɔn we dɛn akt pan.

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

Ɔl di we dɛn fɔ aksept wan opshɔnal opshɔn ɔbjɛkt, wan string we de tɔch wan patikyula we, ɔ natin (we de bigin wan plɔgin wit difɔlt bihayvya):

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

Ɛni plɔgin de ɛksplɔz in raw kɔnstrɔkta bak pan wan Constructorprɔpati: $.fn.popover.Constructor. If yu want fɔ gɛt wan patikyula plɔgin instans, tek am dairekt frɔm wan ɛlimɛnt: $('[rel="popover"]').data('popover').

Difɔlt sɛtin dɛn

Yu kin chenj di difɔlt sɛtin fɔ wan plɔgin bay we yu chenj di tin we di plɔgin de Constructor.DEFAULTSyuz:

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

Nɔ kɔnflikt nɔ de

Sɔntɛnde i nid fɔ yuz Bootstrap plɔgin dɛn wit ɔda UI fremwɔk dɛn. Insay dɛn kayn tin ya, nemspɛs kɔlishin kin apin wan wan tɛm. If dis apin, yu kin kɔl .noConflictdi plɔgin we yu want fɔ gi bak di valyu fɔ.

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

Di tin dɛn we kin apin

Bootstrap de gi kɔstɔm ivin fɔ bɔku pan di plɔgin dɛn yunik akshɔn dɛn. Jɛnɛral wan, dɛn wan ya kin kam insay wan infinitiv ɛn past patisipul fɔm - usay di infinitiv (ɛks. show) kin trig we wan ivin bigin, ɛn in past patisipul fɔm (ɛks. shown) kin trig we wan akshɔn dɔn.

As of 3.0.0, ɔl di Bootstrap ivin dɛn gɛt nemspɛs.

Ɔl di infinitiv ivin dɛn de gi preventDefaultfunkshɔnaliti. Dis de gi di abiliti fɔ stɔp di ɛgzikishɔn fɔ wan akshɔn bifo i bigin.

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

Sanitiza we dɛn kin yuz fɔ was

Tultip ɛn Popovers de yuz wi bilt-in sanitiza fɔ sanitayz opshɔn dɛn we de aksept HTML.

Di difɔlt whiteListvalyu na di wan we de dɔŋ ya:

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: []
}

If yu want fɔ ad nyu valyu dɛn to dis difɔlt whiteListyu kin du dɛn tin ya:

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)

If yu want fɔ baypas wi sanitiza bikɔs yu lɛk fɔ yuz laybri we dɛn dɔn gi yu, fɔ ɛgzampul DOMPurify , yu fɔ du dɛn tin ya:

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

Brawza dɛn we nɔ gɛtdocument.implementation.createHTMLDocument

If na brawza dɛn we nɔ de sɔpɔt document.implementation.createHTMLDocument, lɛk Intanɛt Ɛksplɔrɔ 8, di sanitayz fɛnshɔn we dɛn bil insay de gi di HTML bak lɛk aw i de.

If yu want fɔ du sanitayzeshɔn na dis kes, duya spɛsifa sanitizeFnɛn yuz wan ɛksternal laybri lɛk DOMPurify .

Vɛshɔn nɔmba dɛn

Di vɛshɔn fɔ ɛni wan pan Bootstrap in jQuery plɔgin dɛn kin akses tru di VERSIONprɔpati fɔ di plɔgin in kɔnstrɔkta. Fɔ ɛgzampul, fɔ di tultip plɔgin:

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

Nɔ spɛshal fɔl bak we dɛn nɔ yuz JavaSkript

Bootstrap in plɔgin dɛn nɔ de fɔdɔm bak patikyula grasful wan we JavaSkript nɔ de wok. If yu bisin bɔt di yuza ɛkspiriɛns na dis kes, yuz <noscript>fɔ ɛksplen di sityueshɔn (ɛn aw fɔ ri-ɛnabul JavaSkript) to yu yuza dɛn, ɛn/ɔ ad yu yon kɔstɔm fɔlbak dɛn.

Tɔd-pati laybri dɛn

Bootstrap nɔ ɔfishal wan sɔpɔt tɔd-pati JavaSkript laybri dɛn lɛk Prototype ɔ jQuery UI. Pan ɔl .noConflictwe tin dɛn kin apin ɛn we gɛt nem-spɛs, prɔblɛm dɛn kin de we gɛt fɔ du wit di kɔmpitishɔn we yu nid fɔ fiks fɔ yusɛf.

Transishɔn dɛn transishɔn.js

Bɔt di chenj dɛn we de apin

Fɔ simpul transishɔn ifɛkt dɛn, put transition.jswan tɛm nia di ɔda JS fayl dɛn. If yu de yuz di kɔmpilayt (ɔ minified) bootstrap.js, nid nɔ de fɔ put dis insay—i dɔn ɔlrɛdi de.

Wetin de insay

Transition.js na wan besik ɛp fɔ transitionEndivintɛns dɛn ɛn bak wan CSS transishɔn ɛmulatɔ. Na di ɔda plɔgin dɛn de yuz am fɔ chɛk fɔ CSS transishɔn sɔpɔt ɛn fɔ kech transishɔn dɛn we de hang.

Disable di transishɔn dɛn

Transishɔn dɛn kin disable ɔlsay bay we yu yuz di JavaSkript snipɛt we de dɔŋ ya, we fɔ kam afta transition.jsbootstrap.jsɔ bootstrap.min.js, as i bi) dɔn lod:

$.support.transition = false

Modal dɛn we de na di modal.js

Modal dɛn na strimlayn, bɔt fleksibul, dayalɔg prɔmpt dɛn wit di minimum rikwayd funkshɔnaliti ɛn smat difɔlt dɛn.

Bɔku opin modal dɛn nɔ de sɔpɔt

Mek shɔ se yu nɔ opin wan modal we ɔda wan stil de si. Fɔ sho mɔ pas wan modal wan tɛm, yu nid kɔstɔm kɔd.

Modal mak-ap plesmɛnt

Ɔltɛm tray fɔ put wan modal in HTML kɔd na wan tɔp-lɛvel pozishɔn na yu dɔkyumɛnt fɔ avɔyd ɔda kɔmpɔnɛnt dɛn we de afɛkt di modal in apinɛns ɛn/ɔ di wok we i de du.

Mobayl divays caveats

Sɔm kɔvayt dɛn de bɔt aw fɔ yuz modal dɛn na mobayl divays dɛn. Si wi brawza sɔpɔt dɔkyumɛnt dɛn fɔ di ditel dɛn.

Bikɔs ɔf aw HTML5 de difayn in sɛmantiks, di autofocusHTML atribyut nɔ gɛt ɛni ifɛkt na Bootstrap modals. Fɔ mek yu ebul fɔ du di sem tin, yuz sɔm kɔstɔm JavaSkript:

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

Ɛgzampul dɛn

Statik ɛgzampul

Wan modal we dɛn dɔn rɛnd wit hεda, bɔdi, ɛn sɛt fɔ akshɔn dɛn na di fut.

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

Layf dɛmo

Toggle wan modal via JavaScript bay we yu klik di bɔtin we de dɔŋ. I go slayv dɔŋ ɛn fade insay frɔm di ɔp pat na di pej.

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

Mek modal dɛn we pɔsin kin ebul fɔ yuz

Mek shɔ se yu ad role="dialog"ɛn aria-labelledby="...", we de rɛfrɛns di modal taytul, to .modal, ɛn role="document"to di .modal-dialogsɛf.

Apat frɔm dat, yu kin gi diskripshɔn fɔ yu modal dayalɔg wit aria-describedbyon .modal.

Fɔ put di fim dɛn na Yutub fɔ put insay

Fɔ ɛmbas Yutub fim dɛn na modal dɛn nid fɔ gɛt ɔda JavaSkript we nɔ de na Bootstrap fɔ mek i stɔp fɔ ple ɔtomɛtik wan ɛn ɔda tin dɛn. Si dis ɛp Stack Overflow post fɔ mɔ infɔmeshɔn.

Saiz dɛn we yu kin pik

Modal dɛn gɛt tu opshɔnal saiz dɛn, we de bay modifya klas dɛn fɔ put pan wan .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>

Rimov di animashɔn

Fɔ modal dɛn we jɔs de apia pas fɔ fade in fɔ si, pul di .fadeklas frɔm yu modal mak.

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

Yuz di grid sistem

Fɔ tek advantej pan di Bootstrap grid sistem insay wan modal, jɔs nest .rows insay di .modal-bodyɛn afta dat yuz di nɔmal grid sistem klas dɛn.

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

Yu gɛt bɔku bɔtin dɛn we ɔl de trig di sem modal, jɔs wit smɔl difrɛn tin dɛn? Yuz event.relatedTargetɛn HTML data-*atribyut dɛn (i kin bi bay jQuery ) fɔ chenj di tin dɛn we de insay di modal dipen pan us bɔtin dɛn klik. Si di Modal Events docs fɔ di ditel dɛn bɔt relatedTarget, .

...mɔ bɔtin dɛn...
<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)
})

Aw fɔ yuz am

Di modal plɔgin de chenj yu kɔntinyu we yu ayd we yu aks fɔ am, bay we yu yuz data atribyut ɔ JavaSkript. I de ad bak .modal-opento di <body>fɔ ɔvalayz difɔlt skrolin bihayvya ɛn jenarayz wan .modal-backdropfɔ gi wan klik eria fɔ dismis di modal dɛn we dɛn sho we yu klik ausayd di modal.

Via data atribyut dɛn

Aktiv wan modal we nɔ rayt JavaSkript. Sɛt data-toggle="modal"pan wan kɔntrol ɛlimɛnt, lɛk wan bɔtin, wit wan data-target="#foo"ɔ href="#foo"fɔ tɔch wan patikyula modal fɔ tɔgl.

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

Yu kin yuz JavaSkript fɔ yuz am

Kɔl wan modal wit id myModalwit wan layn na JavaSkript:

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

Di tin dɛn we yu kin pik fɔ du

Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-, lɛk insay data-backdrop="".

Nem kayn balans tɔk bɔt
bakdrop fɔ de boolean ɔ di string'static' tru Inklud wan modal-bakdrop ɛlimɛnt. Ɔda we de fɔ du dat, spɛsifa staticfɔ wan bakdrop we nɔ de lɔk di modal we yu klik.
kibɔd fɔ di kibɔd boolean we dɛn kɔl tru Klos di modal we dɛn prɛs di ɛspɛk ki
sho boolean we dɛn kɔl tru Sho di modal we dɛn initialize.
fa rod lay

Dis opshɔn nɔ de igen frɔm v3.3.0 ɛn dɛn dɔn pul am na v4. Wi kin rikɔmɛnd insted fɔ yuz klaynt-sayd tɛmplatin ɔ wan data binding fremwɔk, ɔ kɔl jQuery.load yusɛf.

If dɛn gi wan rimot URL, dɛn go lod di tin dɛn wan tɛm bay di we aw jQuery de loadyuz ɛn dɛn go injɛkt am na di .modal-contentdiv. If yu de yuz di data-api, yu kin yuz di hrefatribyut ɔda we fɔ sho di rimot sɔs. Wan ɛgzampul bɔt dis de dɔŋ ya:

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

Di we aw dɛn de du am

Aktiv yu kɔntinyu as modal. Aksept wan opshɔnal opshɔn dɛn object.

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

Manually de toggle wan modal. Ritɔn to di pɔsin we kɔl bifo di modal dɔn rili sho ɔ ayd (dat na bifo di shown.bs.modalɔ hidden.bs.modalivin apin).

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

Manually de opin wan modal. Ritɔn to di pɔsin we kɔl bifo di modal dɔn rili sho (dat na bifo di shown.bs.modalivin apin).

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

Manually de ayd wan modal. Ritɔn to di pɔsin we kɔl bifo di modal dɔn rili ayd (dat na bifo di hidden.bs.modalivin apin).

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

Rijɔst di modal in pozishɔn fɔ kɔnt wan skrolba if wan fɔ apia, we go mek di modal jomp to di lɛft.

Na onli nid we di ayt fɔ di modal chenj we i opin.

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

Di tin dɛn we kin apin

Bootstrap in modal klas de ɛksplɔz sɔm ivin dɛn fɔ huk insay modal funkshɔnaliti.

Ɔl di modal ivin dɛn de faya na di modal sɛf (dat na na di <div class="modal">).

Di kayn tin we apin Tɔk bɔt
sho.bs.modal fɔ sho Dis ivent de faya wantɛm wantɛm we dɛn kɔl di showinstans mɛtɔd. If na klik, di ɛlimɛnt we dɛn klik de as di relatedTargetprɔpati fɔ di ivin.
we dɛn sho.bs.modal Dis ivent de faya we di modal dɔn mek di pɔsin we de yuz am si (go wet fɔ mek di CSS transishɔn dɛn dɔn). If na klik, di ɛlimɛnt we dɛn klik de as di relatedTargetprɔpati fɔ di ivin.
ayd.bs.modal fɔ di wan dɛn we de Dis ivent de faya wantɛm wantɛm we hidedɛn dɔn kɔl di instans mɛtɔd.
we dɛn ayd.bs.modal Dis ivent de faya we di modal dɔn dɔn fɔ ayd frɔm di yuza (go wet fɔ CSS transishɔn dɛn fɔ dɔn).
lod.bs.modal we dɛn dɔn lod Dis ivent de faya we di modal dɔn lod kɔntinyu yuz di remoteopshɔn.
$('#myModal').on('hidden.bs.modal', function (e) {
  // do something...
})

Drɔpdɔwn dɛn dropdown.js

Ad drɔp-dɔwn mɛnyu dɛn to klos to ɛnitin wit dis simpul plɔgin, lɛk di navbar, tab dɛn, ɛn pils dɛn.

Insay wan navbar

Insay di pils dɛn

Via data atribyut ɔ JavaSkript, di drɔpdɔwn plɔgin de chenj di tin dɛn we dɛn ayd (drɔpdɔwn mɛnyu dɛn) bay we i de chenj di .openklas na di mama ɛn papa list aytem.

Na mobayl divays dɛn, we yu opin wan drɔpdɔwn ad wan .dropdown-backdropas tap eria fɔ lɔk drɔpdɔwn mɛnyu dɛn we yu tap na do na di mɛnyu, we na sɔntin we yu nid fɔ gɛt di rayt iOS sɔpɔt. Dis min se fɔ chenj frɔm wan opin drɔpdɔwn mɛnyu to difrɛn drɔpdɔwn mɛnyu yu nid fɔ tap ɛkstra na mobayl.

Notis: Dɛn data-toggle="dropdown"kin abop pan di atribyut fɔ lɔk drɔpdɔwn mɛnyu dɛn na wan aplikeshɔn lɛvɛl, so i fayn fɔ yuz am ɔltɛm.

Via data atribyut dɛn

Ad data-toggle="dropdown"to link ɔ bɔtin fɔ chenj wan drɔp-dɔwn.

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

Fɔ mek di URL dɛn nɔ pwɛl wit di link bɔtin dɛn, yuz di data-targetatribyut instead fɔ 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>

Yu kin yuz JavaSkript fɔ yuz am

Kɔl di drɔpdɔwn dɛn bay JavaSkript:

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

data-toggle="dropdown"stil nid fɔ de

I nɔ mata if yu kɔl yu drɔpdɔwn bay JavaSkript ɔ insted yu yuz di data-api, data-toggle="dropdown"i nid fɔ de ɔltɛm na di drɔpdɔwn in trig ɛlimɛnt.

Nɔn

Tɔgl di drɔpdɔwn mɛnyu fɔ wan givɛn navbar ɔ tab nevigishɔn.

Ɔl di drɔpdɔwn ivin dɛn de faya na di .dropdown-menu's mama ɛn papa ɛlimɛnt.

Ɔl di drɔpdɔwn ivin dɛn gɛt relatedTargetprɔpati, we in valyu na di toggling ankɔ ɛlimɛnt.

Di kayn tin we apin Tɔk bɔt
sho.bs.drɔpdɔwn Dis ivent de faya wantɛm wantɛm we dɛn kɔl di sho instans mɛtɔd.
sho.bs.drɔpdɔwn Dis ivin de faya we dɛn dɔn mek di drɔpdɔwn si di pɔsin we de yuz am (go wet fɔ CSS transishɔn dɛn, fɔ dɔn).
ayd.bs.drɔpdɔwn Dis ivent de faya wantɛm wantɛm we dɛn dɔn kɔl di ayd instans mɛtɔd.
ayd.bs.drɔpdɔwn Dis ivent de faya we di drɔpdɔwn dɔn dɔn fɔ ayd frɔm di yuza (go wet fɔ CSS transishɔn dɛn, fɔ dɔn).
$('#myDropdown').on('show.bs.dropdown', function () {
  // do something…
})

SkrolSpy scrollspy.js

Ɛgzampul na navbar

Di ScrollSpy plɔgin na fɔ ɔtomɛtik ɔpdet nav target dɛn bays pan skrol pozishɔn. Skrol di eria we de dɔŋ di navbar ɛn wach di aktif klas chenj. Di drɔpdɔwn sab aytem dɛn go aylayt bak.

@bɔmp

Ad leggings keytar, brunch id art pati dolor labore. Pitchfork yr enim lo-fi bifo dem sold out qui. Tumblr fam-to-tebul baysikul rayt ɛnitin. Anim keffiyeh karles kardigan. Velit seitan mcsweeney in foto booth 3 wolf mun irure. Cosby sweta lomo jins shɔt, williamsburg hoodie minim qui yu probabli nɔ yɛri bɔt dɛn et kadigan trɔst fund culpa biodiesel wes anderson aesthetic. Nihil tatu accusamus, cred irony bayodizel keffiyeh artisan ullamco konsekvat.

@mdo na @mdo

Veniam marfa moustache sketbod, adipisicing fugiat velit pitchfork biad. Frigan biad aliqua cupidatat mcsweeney in vero. Cupidatat fo loko nisi, ea helvetika nula karles. Tattoo cosby sweta fud trak, mcsweeney in quis non frigan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetik eksasaiz quis gentrify. Bruklin adipisicing kraft bia vays keytar deserunt.

wan

Occaecat komodo alikwa delektɔs. Fap kraft bia deserunt skateboard ea. Lomo baysikul rayt adipisicing banh mi, velit ea sunt nɛks lɛvɛl locavore singl-ɔrijin kɔfi in magna veniam. Haj layf id vinyl, eko pak konsekwat quis aliquip banh mi pitchfork. Vero VHS est adipisicing fɔ di wan dɛn we de yuz am. Konsectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus konsectetur fanny pak ifon.

tu

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 mesenja bag marfa wetin delektus fud trak. Sapiente sint id asumenda. Locavore sed helvetica cliche irony, thundercats yu probabli noh don yehri boht dem consequat hoodie gluten-fri lo-fi fap aliquip. Labore elit placeat bifo dɛn sɛl aut, terry richardson proident brunch nesciunt quis cosby sweta pariatur keffiyeh ut helvetica artisan. Cardigan kraft bia seitan redimade velit. VHS chambray laboris t ɛ m ɔ r v ɛ n ɛ m. Anim mollit minim komodo ullamco na di tendakat.

Aw fɔ yuz am

I nid fɔ gɛt Bootstrap nav

Scrollspy naw nid fɔ yuz wan Bootstrap nav kɔmpɔnɛnt fɔ mek yu ebul fɔ aylayt di aktif link dɛn fayn fayn wan.

Risolvable ID target dɛn nid fɔ de

Navbar link dɛn fɔ gɛt id target dɛn we dɛn kin sɔlv. Fɔ ɛgzampul, a <a href="#home">home</a>fɔ kɔrɛkt to sɔntin we de na di DOM lɛk <div id="home"></div>.

Nɔn- :visibletarget ɛlimɛnt dɛn we dɛn nɔ tek tɛm wit

Target elements we nɔ de :visibleakɔdin to jQuery go ignore ɛn dɛn kɔrɛspɔndɛns nav aytem dɛn nɔ go ɛva aylayt.

I nid fɔ gɛt rilitiv pozishɔn

No mata di implimentishɔn we, scrollspy nid fɔ yuz position: relative;pan di ɛlimɛnt we yu de spay pan. Bɔku tɛm dis na di <body>. We yu de skrol spay pan ɛlimɛnt dɛn we nɔto di <body>, mek shɔ se yu gɛt heightsɛt ɛn overflow-y: scroll;yuz am.

Via data atribyut dɛn

Fɔ mek i izi fɔ ad skrolspi bihayvya to yu tɔpba nevigishɔn, ad data-spy="scroll"to di ɛlimɛnt we yu want fɔ spay pan (mɔs tipikli dis go bi di <body>). Dɔn ad di data-targetatribyut wit di ID ɔ klas fɔ di mama ɛn papa ɛlimɛnt fɔ ɛni Bootstrap .navkɔmpɔnɛnt.

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>

Yu kin yuz JavaSkript fɔ yuz am

Afta yu dɔn ad position: relative;yu CSS, kɔl di skrol dɛn bay JavaSkript:

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

Di we aw dɛn de du am

.scrollspy('refresh')

We yu de yuz scrollspy in kɔnjɔkt wit ad ɔ pul ɛlimɛnt dɛn frɔm di DOM, yu go nid fɔ kɔl di rifresh we lɛk so:

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

Di tin dɛn we yu kin pik fɔ du

Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-, lɛk insay data-offset="".

Nem kayn balans tɔk bɔt
ɔfset nɔmba 10. Di wan dɛn we de Piksɛl dɛn fɔ ɔfset frɔm ɔp we yu de kɔl di pozishɔn fɔ skrol.

Di tin dɛn we kin apin

Di kayn tin we apin Tɔk bɔt
aktivet.bs.skrol dɛn Dis ivent de faya ɛnitɛm we di skrol spy mek nyu tin wok.
$('#myScrollspy').on('activate.bs.scrollspy', function () {
  // do something…
})

Tab dɛn we yu kin chenj tab.js

Ɛgzampul tab dɛn

Ad kwik, dinamik tab funkshɔnaliti fɔ chenj tru pan dɛn fɔ lokal kɔntinyu, ivin tru drɔpdɔwn mɛnyu dɛn. Tab dɛn we dɛn dɔn nɛst nɔ de sɔpɔt.

Raw denim yu probabli noh yehri boht dem jean shorts Austin. Nesciunt tofu stumptown aliqua, retro sint masta klin. Mustache kliche tempor, wiliamsbɔg karls vegan ɛlvɛtika. Reprehenderit butcher retro keffiyeh drim kat sint. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip plesat salvia cillum iphone. Seitan aliquip quis kardigan american klos, butcher voluptate nisi qui.

Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.

I de ɛkstɛnd di nevigishɔn we gɛt tab dɛn

Dis plɔgin de ɛkstɛnd di tab nevigishɔn kɔmpɔnɛnt fɔ ad tab eria dɛn.

Aw fɔ yuz am

Enable tabable tabs via JavaScript (ɛni tab nid fɔ aktiv wan wan):

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

Yu kin aktiv wan wan tab dɛn difrɛn we dɛn:

$('#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)

Mak-ap fɔ di tin dɛn we de apin

Yu kin aktiv wan tab ɔ pil nevigishɔn we yu nɔ rayt ɛni JavaSkript bay we yu jɔs spɛsifa data-toggle="tab"ɔ data-toggle="pill"pan wan ɛlimɛnt. We yu ad di navɛn nav-tabsklas dɛn to di tab uli go yuz di Bootstrap tab stayl , we yu ad di navɛn nav-pillsklas dɛn go yuz di pil stayl .

<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 effekt we yu de du

Fɔ mek di tab dɛn go fayn, ad .fadeto ɛni wan pan dɛn .tab-pane. Di fɔs tab pan fɔ gɛt bak .infɔ mek di fɔs tin dɛn we de insay de sho.

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

Di we aw dɛn de du am

$().tab

Aktiv wan tab ɛlimɛnt ɛn kɔntinyu kɔntena. Tab fɔ gɛt ɛni wan pan wan data-targetɔ wan hrefwe de tɔch wan kɔntena node na di DOM. Insay di ɛgzampul dɛn we de ɔp, di tab dɛn na di <a>s wit data-toggle="tab"atribyut dɛn.

.tab('show')

Pik di tab we dɛn gi ɛn sho di tin dɛn we gɛt fɔ du wit am. Ɛni ɔda tab we dɛn bin dɔn pik bifo tɛm nɔ kin pik ɛn di tin dɛn we gɛt fɔ du wit am kin ayd. Ritɔn to di pɔsin we kɔl bifo dɛn rili sho di tab pan (dat na bifo di shown.bs.tabtin apin).

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

Di tin dɛn we kin apin

We yu de sho nyu tab, di tin dɛn we de apin de faya insay di ɔda we we de dɔŋ ya:

  1. hide.bs.tab(na di tab we de wok naw)
  2. show.bs.tab(na di tab we dɛn go sho)
  3. hidden.bs.tab(na di fɔs aktif tab, di sem wan we bin de fɔ di hide.bs.tabivin)
  4. shown.bs.tab(na di nyu-aktiv tab we jɔs sho, di sem wan we de fɔ di show.bs.tabivin)

If no tab nɔ bin dɔn ɔlrɛdi aktif, den di hide.bs.tabɛn hidden.bs.tabivin dɛn nɔ go faya.

Di kayn tin we apin Tɔk bɔt
sho.bs.tab fɔ sho Dis ivent de faya pan tab sho, bɔt bifo dɛn dɔn sho di nyu tab. Yuz event.targetɛn event.relatedTargetfɔ tɔch di aktiv tab ɛn di aktiv tab we bin de bifo (if i de) rispɛktful wan.
we dɛn sho.bs.tab Dis ivent de faya pan tab sho afta dɛn dɔn sho wan tab. Yuz event.targetɛn event.relatedTargetfɔ tɔch di aktiv tab ɛn di aktiv tab we bin de bifo (if i de) rispɛktful wan.
ayd.bs.tab fɔ di wan dɛn we de Dis ivent de faya we dɛn fɔ sho nyu tab (ɛn so di fɔs aktif tab fɔ ayd). Yuz event.targetɛn event.relatedTargetfɔ tɔch di tab we de wok naw ɛn di nyu tab we go aktiv jisnɔ, rispɛktful wan.
di tab we dɛn ayd.bs Dis ivent de faya afta dɛn dɔn sho nyu tab (ɛn so di fɔs aktif tab de ayd). Yuz event.targetɛn event.relatedTargetfɔ tɔch di fɔs aktif tab ɛn di nyu aktif tab, rispɛktful wan.
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  e.target // newly activated tab
  e.relatedTarget // previous active tab
})

Tultip dɛn tooltip.js

Inspɛkt bay di fayn fayn jQuery.tipsy plɔgin we Jason Frame rayt; Tultip dɛn na ɔpdet vɛshɔn, we nɔ de abop pan pikchɔ dɛn, dɛn de yuz CSS3 fɔ animashɔn dɛn, ɛn data-atribyut dɛn fɔ lokal taytul stɔrɔj.

Tultip dɛn we gɛt taytul dɛn we nɔ gɛt ziro nɔ de ɛva sho.

Ɛgzampul dɛn

Hova oba di link dɛn we de dɔŋ fɔ si tultip dɛn:

Tayt pant neks levul keffiyeh yu probabli no don yehri boht dem. Foto booth biad raw denim letterpress vegan mesenja bag stumptown. Fam-to-tebul seitan, mcsweeney in fixie sataynabul quinoa 8-bit american apɛl gɛt wan tɛri richardson vaynil chambray. Beard stumptown, kardigan banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, fo loko mcsweeney in klin vegan chambray. A rili ironic artisan wetin keytar , scenester fam-to-tebul banksy Austin twita handle frigan cred raw denim singl-orijin kɔfi vayral.

Statik tultip fɔ yuz

Fo opshɔn dɛn de: ɔp, rayt, dɔŋ, ɛn lɛft alaynɛd.

Fo dairekshɔn dɛn

<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 funkshɔnaliti

Fɔ pefɔmɛns rizin, di Tooltip ɛn Popover data-apis na opt-in, we min se yu fɔ initialize dɛn yusɛf .

Wan we fɔ initialize ɔl di tultip dɛn na wan pej na fɔ pik dɛn bay dɛn data-toggleatribyut:

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

Aw fɔ yuz am

Di tultip plɔgin de jenarayz kɔntinyu ɛn mak pan dimand, ɛn bay difɔlt de put tultip dɛn afta dɛn trig ɛlimɛnt.

Trig di tultip bay JavaSkript:

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

Mak-ap fɔ di tin dɛn we de apin

Di mak we yu nid fɔ wan tultip na jɔs wan dataatribyut ɛn titlena di HTML ɛlimɛnt yu want fɔ gɛt tultip. Di mak we dɛn dɔn mek fɔ wan tultip rili simpul, pan ɔl we i nid fɔ gɛt pozishɔn (bay difɔlt, topdi plɔgin sɛt to).

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

Link dɛn we gɛt bɔku layn dɛn

Sɔntɛnde yu kin want fɔ ad wan tultip to wan haypa link we de rap bɔku layn dɛn. Di difɔlt bihayvya fɔ di tultip plɔgin na fɔ sɛnt am ɔrizɔntal ɛn vertikal. Ad white-space: nowrap;to yu ankɔ dɛn fɔ avɔyd dis.

Tultip dɛn na bɔtin grup dɛn, input grup dɛn, ɛn tebul dɛn nid spɛshal sɛtin

We yu de yuz tultip dɛn pan ɛlimɛnt dɛn we de insay a .btn-groupɔ wan .input-group, ɔ pan ɛlimɛnt dɛn we gɛt fɔ du wit tebul ( <td>, <th>, <tr>, <thead>, <tbody>, <tfoot>), yu go gɛt fɔ spɛsifa di opshɔn container: 'body'(we dɛn rayt dɔŋ ya) fɔ avɔyd sayd ɛfɛkt dɛn we yu nɔ want (lɛk di ɛlimɛnt we de gro big ɛn/ ɔ i kin lɔs in rawnd kɔna dɛn we dɛn trig di tultip).

Nɔ tray fɔ sho tultip dɛn bɔt di tin dɛn we dɛn ayd

If yu kɔl $(...).tooltip('show')we di target ɛlimɛnt de, dat display: none;go mek di tultip nɔ de kɔrɛkt wan.

Tultip dɛn we pɔsin kin ebul fɔ yuz fɔ kibɔd ɛn ɛp tɛknɔlɔji

Fɔ di wan dɛn we de yuz kibɔd, ɛn mɔ di wan dɛn we de yuz ɛp tɛknɔlɔji dɛn, yu fɔ jɔs ad tultip dɛn to di tin dɛn we yu kin pe atɛnshɔn pan di kibɔd lɛk link dɛn, fɔm kɔntrol dɛn, ɔ ɛni ɛlimɛnt we yu want we gɛt tabindex="0"atribyut.

Tultip dɛn pan disabul ɛlimɛnt dɛn nid fɔ rap ɛlimɛnt dɛn

Fɔ ad tultip to wan disabledɔ .disabledɛlimɛnt, put di ɛlimɛnt insay a <div>ɛn yuz di tultip to dat <div>insted.

Di tin dɛn we yu kin pik fɔ du

Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-, lɛk insay data-animation="".

Notis se fɔ sikyɔriti rizin dɛn nɔ go ebul fɔ gi di sanitize, sanitizeFnɛn whiteListopshɔn dɛn we yu de yuz data atribyut dɛn.

Nem Kayn Balans Tɔk bɔt
animashɔn fɔ di pikchɔ dɛn boolean we dɛn kɔl tru Aplay wan CSS fade transishɔn to di tultip
kɔntena we dɛn kin put insay string fɔ di wan dɛn we de | lay lay

Apɛnd di tultip to wan patikyula ɛlimɛnt. Fɔ ɛgzampul: container: 'body'. Dis opshɔn rili yusful bikɔs i de alaw yu fɔ posishun di tultip na di flɔ na di dɔkyumɛnt nia di trig ɛlimɛnt - we go mek di tultip nɔ flɔt away frɔm di trig ɛlimɛnt we yu de risayz di winda.

westɛm nɔmba | tin 0. Di wan dɛn we de

Dilay fɔ sho ɛn ayd di tultip (ms) - nɔ de aplay to manual trigger tayp

If dɛn gi wan nɔmba, dɛn kin delay fɔ ɔl tu di ayd/sho

Objekt strɔkchɔ na:delay: { "show": 500, "hide": 100 }

html boolean we dɛn kɔl lay Put HTML insay di tultip. If na lay, textdɛn go yuz jQuery in we fɔ put kɔntinyu insay di DOM. Yuz tɛks if yu de wɔri bɔt XSS atak dɛn.
ples fɔ put am string fɔ di wan dɛn we de | wok 'ɔp'

Aw fɔ posishun di tultip - ɔp | dɔŋ ya | lɛft | rayt | ɔto.
We dɛn spɛsifa "auto", i go dinamik wan rioriɛnt di tultip. Fɔ ɛgzampul, if plesmɛnt na "ɔto lɛft", di tultip go sho na di lɛft we i pɔsibul, ɔdasay i go sho rayt.

We dɛn yuz wan fɛnshɔn fɔ no di plesmɛnt, dɛn kin kɔl am wit di tultip DOM node as in fɔs argumɛnt ɛn di trigɛn ɛlimɛnt DOM node as in sɛkɔn. Di thiskɔntɛks de sɛt to di tultip instans.

sɛlɛktɔ rop lay If dɛn gi wan sɛlɛktɔ, dɛn go gi tultip ɔbjɛkt dɛn to di target dɛn we dɛn dɔn spɛsifa. In prɔsis, dɛn kin yuz dis fɔ yuz tultip dɛn bak to dinamik ad DOM ɛlimɛnt dɛn ( jQuery.onsɔpɔt). Si dis ɛn wan ɛgzampul we gɛt bɔku tin dɛn fɔ no bɔt .
tɛmplat fɔ di wan dɛn we de rop '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'

Base HTML fɔ yuz we yu de mek di tultip.

Di tultip dɛn titlego injɛkt insay di .tooltip-inner.

.tooltip-arrowgo bi di tultip in aro.

Di ɔtamost wrap ɛlimɛnt fɔ gɛt di .tooltipklas.

taytul string fɔ di wan dɛn we de | wok '' .

Difɔlt taytul valyu if titleatribyut nɔ de.

If dɛn gi wan fɛnshɔn, dɛn go kɔl am wit in thisrɛfrɛns sɛt to di ɛlimɛnt we di tultip ataya to.

stat rop 'hova fɔs'. Aw di tultip de trig - klik | hover fɔ di wan dɛn we de wok | fɔs fɔs | buk. Yu kin pas bɔku trig dɛn; separet dɛn wit wan ples. manualnɔ kin ebul fɔ jɔyn wit ɛni ɔda trig.
di say fɔ si di tin dɛn string fɔ di wan dɛn we de | ɔbjɛkt | wok { sɛlɛktɔ: 'bɔdi', padding: 0 }

Kip di tultip insay di bɔund fɔ dis ɛlimɛnt. Fɔ ɛgzampul: viewport: '#viewport'ɔ{ "selector": "#viewport", "padding": 0 }

If dɛn gi wan fɛnshɔn, dɛn kɔl am wit di trig ɛlimɛnt DOM node as in wangren argumɛnt. Di thiskɔntɛks de sɛt to di tultip instans.

fɔ mek yu sanitayz boolean we dɛn kɔl tru Enable ɔ disable di sanitayzeshɔn. If activated 'template', 'content'ɛn 'title'opshɔn dɛn go sanitayz.
waytList fɔ di wan dɛn we de tin Difɔlt valyu Objek we gɛt atribyut ɛn tag dɛn we dɛn alaw
sanitayzFn fɔ du nul we de na di wɔl | wok nɔ gɛt wan valyu Na ya yu kin saplae yu own sanitize function. Dis kin fayn if yu lɛk fɔ yuz laybri we dɛn dɔn gi yu fɔ du sanitayzeshɔn.

Data atribyut fɔ wan wan tultip dɛn

Opshɔn fɔ wan wan tultip dɛn kin ɔda we fɔ spɛsifa tru di yus fɔ data atribyut dɛn, lɛk aw dɛn ɛksplen am ɔp.

Di we aw dɛn de du am

$().tooltip(options)

Ataya wan tultip handla to wan ɛlimɛnt kɔlɛkshɔn.

.tooltip('show')

Rivɛl wan ɛlimɛnt in tultip. Ritɔn to di pɔsin we kɔl bifo dɛn rili sho di tultip (dat na bifo di shown.bs.tooltiptin apin). Dis kin bi "manual" trigεrin fכ di tultip. Tultip dɛn we gɛt taytul dɛn we nɔ gɛt ziro nɔ de ɛva sho.

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

.tooltip('hide')

Ayd wan ɛlimɛnt in tultip. Ritɔn to di pɔsin we kɔl bifo di tultip dɔn rili ayd (dat na bifo di hidden.bs.tooltiptin apin). Dis kin bi "manual" trigεrin fכ di tultip.

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

.tooltip('toggle')

Toggles wan element in tultip. Ritɔn to di pɔsin we kɔl bifo dɛn rili sho ɔ ayd di tultip (dat na bifo di shown.bs.tooltipɔ hidden.bs.tooltipivin apin). Dis kin bi "manual" trigεrin fכ di tultip.

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

.tooltip('destroy')

Ayd ɛn pwɛl wan ɛlimɛnt in tultip. Tultip dɛn we de yuz delegɛshɔn (we dɛn mek yuz di selectoropshɔn ) nɔ kin ebul fɔ pwɛl wan wan pan disɛndant trig ɛlimɛnt dɛn.

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

Di tin dɛn we kin apin

Di kayn tin we apin Tɔk bɔt
sho.bs.tultip fɔ sho Dis ivent de faya wantɛm wantɛm we dɛn kɔl di showinstans mɛtɔd.
we dɛn sho.bs.tultip Dis ivent de faya we dɛn dɔn mek di tultip si di pɔsin we de yuz am (go wet fɔ mek di CSS transishɔn dɛn dɔn).
ayd.bs.tultip fɔ di wan dɛn we de Dis ivent de faya wantɛm wantɛm we hidedɛn dɔn kɔl di instans mɛtɔd.
di wan dɛn we de ayd.bs.tultip Dis ivent de faya we di tultip dɔn dɔn fɔ ayd frɔm di yuza (go wet fɔ CSS transishɔn dɛn fɔ dɔn).
dɛn dɔn put insay.bs.tultip Dis ivent de faya afta di show.bs.tooltipivent we dɛn dɔn ad di tultip tɛmplat to di DOM.
$('#myTooltip').on('hidden.bs.tooltip', function () {
  // do something…
})

Popovers pipul dɛn we de na di popover.js

Ad smɔl ɔvalayz dɛn fɔ kɔntinyu, lɛk di wan dɛn we de na di iPad, to ɛni ɛlimɛnt fɔ haus sɛkɔndari infɔmeshɔn.

Popovers we ɔl tu dɛn taytul ɛn kɔntinyu na zero-lɛngth nɔ de ɛva sho.

Dipɛnsin fɔ di plɔgin

Popovers nid di tultip plɔgin fɔ de insay yu vɛshɔn fɔ Bootstrap.

Opt-in funkshɔnaliti

Fɔ pefɔmɛns rizin, di Tooltip ɛn Popover data-apis na opt-in, we min se yu fɔ initialize dɛn yusɛf .

Wan we fɔ initialize ɔl di popovers na wan pej go bi fɔ pik dɛn bay dɛn data-toggleatribyut:

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

Popovers in button grup, input grup, ɛn tebul dɛn nid spɛshal sɛtin

We yu de yuz popovers pan elemɛnt dɛn we de insay a .btn-groupɔ wan .input-group, ɔ pan ɛlimɛnt dɛn we gɛt fɔ du wit tebul ( <td>, <th>, <tr>, <thead>, <tbody>, <tfoot>), yu go gɛt fɔ spɛsifa di opshɔn container: 'body'(we dɛn rayt dɔŋ ya) fɔ avɔyd sayd ɛfɛkt dɛn we yu nɔ want (lɛk di ɛlimɛnt we de gro big ɛn/ ɔ fɔ lɔs in rawnd kɔna dɛn we di popover de trig).

Nɔ tray fɔ sho popovers pan hidden elements

Invok $(...).popover('show')we di target elemɛnt de display: none;go mek di popover nɔ de kɔrɛkt wan.

Popovers pan disabled elements nid wrapper elements

Fɔ ad popover to a disabledɔ .disabledelement, put di element insay a <div>ɛn put di popover to dat <div>insted.

Link dɛn we gɛt bɔku layn dɛn

Sɔntɛnde yu kin want fɔ ad wan popover to wan haypa link we de rap bɔku layn dɛn. Di difɔlt bihayvya fɔ di popover plɔgin na fɔ sɛnt am ɔrizɔntal ɛn vertikal. Ad white-space: nowrap;to yu ankɔ dɛn fɔ avɔyd dis.

Ɛgzampul dɛn

Statik popover we de na di wɔl

Fo opshɔn dɛn de: ɔp, rayt, dɔŋ, ɛn lɛft alaynɛd.

Popover na di top

Sed posuere konsectetur est na di lobortis. Aenean yu leo ​​quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.

Popover rayt

Sed posuere konsectetur est na di lobortis. Aenean yu leo ​​quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.

Popover na di bottom

Sed posuere konsectetur est na di lobortis. Aenean yu leo ​​quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.

Popover bin kɔmɔt de

Sed posuere konsectetur est na di lobortis. Aenean yu leo ​​quam. Pɛlɛntesk ɔrnare sem lasinia kwam venɛnatis vestibulum.

Layf dɛmo

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

Fo dairekshɔn dɛn

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

Dismis na di nɛks klik

Yuz di focustriga fɔ dismis popovers pan di nɛks klik we di yuza mek.

Speshal mak we nid fɔ dismis-ɔn-nɛks-klik

Fɔ mek yu krɔs-brawza ɛn krɔs-pletfɔm biev fayn, yu fɔ yuz di <a>tɛg, nɔto di <button>tɛg, ɛn yu fɔ put di role="button"ɛn tabindexatribyut dɛn bak.

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

Aw fɔ yuz am

Enable popovers bay JavaSkript:

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

Di tin dɛn we yu kin pik fɔ du

Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-, lɛk insay data-animation="".

Notis se fɔ sikyɔriti rizin dɛn nɔ go ebul fɔ gi di sanitize, sanitizeFnɛn whiteListopshɔn dɛn we yu de yuz data atribyut dɛn.

Nem Kayn Balans Tɔk bɔt
animashɔn fɔ di pikchɔ dɛn boolean we dɛn kɔl tru Aplay wan CSS fade transishɔn to di popover
kɔntena we dɛn kin put insay string fɔ di wan dɛn we de | lay lay

Apɛnd di popover to wan patikyula ɛlimɛnt. Fɔ ɛgzampul: container: 'body'. Dis opshɔn rili yusful bikɔs i de alaw yu fɔ posishun di popover insay di flɔ na di dɔkyumɛnt nia di trig ɛlimɛnt - we go mek di popover nɔ flot away frɔm di trig ɛlimɛnt we yu de risayz di winda.

satisfay string fɔ di wan dɛn we de | wok '' .

Difɔlt kɔntinyu valyu if data-contentatribyut nɔ de.

If dɛn gi wan fɛnshɔn, dɛn go kɔl am wit in thisrɛfrɛns sɛt to di ɛlimɛnt we di popover ataya to.

westɛm nɔmba | tin 0. Di wan dɛn we de

Dilay fɔ sho ɛn ayd di popover (ms) - nɔ de aplay to manual trigger type

If dɛn gi wan nɔmba, dɛn kin delay fɔ ɔl tu di ayd/sho

Objekt strɔkchɔ na:delay: { "show": 500, "hide": 100 }

html boolean we dɛn kɔl lay Put HTML insay di popover. If na lay, textdɛn go yuz jQuery in we fɔ put kɔntinyu insay di DOM. Yuz tɛks if yu de wɔri bɔt XSS atak dɛn.
ples fɔ put am string fɔ di wan dɛn we de | wok 'rayt'

Aw fɔ posishun di popover - top | dɔŋ ya | lɛft | rayt | ɔto.
We dɛn spɛsifa "auto", i go dinamik wan rioriɛnt di popover. Fɔ ɛgzampul, if plesmɛnt na "ɔto lɛft", di popover go sho na di lɛft we i pɔsibul, ɔdasay i go sho rayt.

We dɛn yuz wan fɛnshɔn fɔ no di plesmɛnt, dɛn kin kɔl am wit di popover DOM node as in fɔs argumɛnt ɛn di trigɛn ɛlimɛnt DOM node as in sɛkɔn. Di thiskɔntɛks de sɛt to di popover instans.

sɛlɛktɔ rop lay If dɛn gi wan sɛlɛktɔ, dɛn go deleget popover ɔbjɛkt dɛn to di target dɛn we dɛn dɔn spɛsifa. Insay prɔsis, dɛn kin yuz dis fɔ mek dinamik HTML kɔntinyu fɔ gɛt popovers we dɛn ad. Si dis ɛn wan ɛgzampul we gɛt bɔku tin dɛn fɔ no bɔt .
tɛmplat fɔ di wan dɛn we de rop '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'

Base HTML fɔ yuz we yu de mek di popover.

Di popover's titlego injekt insay di .popover-title.

Di popover's contentgo injekt insay di .popover-content.

.arrowgo bi di popover in aro.

Di ɔtamost wrap ɛlimɛnt fɔ gɛt di .popoverklas.

taytul string fɔ di wan dɛn we de | wok '' .

Difɔlt taytul valyu if titleatribyut nɔ de.

If dɛn gi wan fɛnshɔn, dɛn go kɔl am wit in thisrɛfrɛns sɛt to di ɛlimɛnt we di popover ataya to.

stat rop 'klik'. Aw popover de trig - klik | hover fɔ di wan dɛn we de wok | fɔs fɔs | buk. Yu kin pas bɔku trig dɛn; separet dɛn wit wan ples. manualnɔ kin ebul fɔ jɔyn wit ɛni ɔda trig.
di say fɔ si di tin dɛn string fɔ di wan dɛn we de | ɔbjɛkt | wok { sɛlɛktɔ: 'bɔdi', padding: 0 }

Kip di popover insay di bounds fɔ dis element. Fɔ ɛgzampul: viewport: '#viewport'ɔ{ "selector": "#viewport", "padding": 0 }

If dɛn gi wan fɛnshɔn, dɛn kɔl am wit di trig ɛlimɛnt DOM node as in wangren argumɛnt. Di thiskɔntɛks de sɛt to di popover instans.

fɔ mek yu sanitayz boolean we dɛn kɔl tru Enable ɔ disable di sanitayzeshɔn. If activated 'template', 'content'ɛn 'title'opshɔn dɛn go sanitayz.
waytList fɔ di wan dɛn we de tin Difɔlt valyu Objek we gɛt atribyut ɛn tag dɛn we dɛn alaw
sanitayzFn fɔ du nul we de na di wɔl | wok nɔ gɛt wan valyu Na ya yu kin saplae yu own sanitize function. Dis kin fayn if yu lɛk fɔ yuz laybri we dɛn dɔn gi yu fɔ du sanitayzeshɔn.

Data atribyut fɔ wan wan popover dɛn

Opshɔn fɔ wan wan popover dɛn kin ɔda we fɔ spɛsifa tru di yus fɔ data atribyut dɛn, as dɛn ɛksplen am ɔp.

Di we aw dɛn de du am

$().popover(options)

Initializes popovers fɔ wan ɛlimɛnt kɔllɛkshɔn.

.popover('show')

Rivɛl wan ɛlimɛnt in popover. Ritɔn to di pɔsin we kɔl bifo di popover dɔn rili sho (dat na bifo di shown.bs.popoverivin apin). dis dεn kin kכnsidr am as "manual" trigεr fכ di popover. Popovers we dɛn ɔl tu taytul ɛn kɔntinyu na zero-lɛngth nɔ de ɛva sho.

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

.popover('hide')

Ayd wan ɛlimɛnt in popover. Ritɔn to di pɔsin we kɔl bifo di popover dɔn rili ayd (dat na bifo di hidden.bs.popoverivin apin). dis dεn kin kכnsidr am as "manual" trigεr fכ di popover.

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

.popover('toggle')

Toggles wan element in popover. Ritɔn to di pɔsin we kɔl bifo di popover dɔn rili sho ɔ ayd (dat na bifo di shown.bs.popoverɔ hidden.bs.popoverivin apin). dis dεn kin kכnsidr am as "manual" trigεr fכ di popover.

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

.popover('destroy')

Ayd ɛn pwɛl wan ɛlimɛnt in popover. Popovers we de yuz delegɛshɔn (we dɛn mek yuz di selectoropshɔn ) nɔ kin ebul fɔ pwɛl wan wan pan disɛndant trig ɛlimɛnt dɛn.

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

Di tin dɛn we kin apin

Di kayn tin we apin Tɔk bɔt
sho.bs.popover fɔ di wan dɛn we de Dis ivent de faya wantɛm wantɛm we dɛn kɔl di showinstans mɛtɔd.
sho.bs.popova Dis ivent de faya we di popover dɔn mek visible to di yuza (go wet fɔ CSS transishɔn fɔ dɔn).
ayd.bs.popover fɔ di wan dɛn we de Dis ivent de faya wantɛm wantɛm we hidedɛn dɔn kɔl di instans mɛtɔd.
ayd.bs.powa we de Dis ivent de faya we di popover dɔn dɔn fɔ ayd frɔm di yuza (go wet fɔ CSS transishɔn dɛn fɔ dɔn).
insay.bs.poova Dis ivent de faya afta di show.bs.popoverivent we dɛn dɔn ad di popover tɛmplat to di DOM.
$('#myPopover').on('hidden.bs.popover', function () {
  // do something…
})

Alert mɛsej dɛn alert.js

Ɛgzampul alɛt dɛn

Ad dismis funkshɔnaliti to ɔl di alɛt mɛsej dɛn wit dis plɔgin.

We yu de yuz .closebɔtin, i fɔ bi di fɔs pikin fɔ di .alert-dismissibleɛn nɔ tɛks kɔntinyu nɔ go kam bifo am na di mak.

Aw fɔ yuz am

Jɔs ad data-dismiss="alert"to yu klos bɔtin fɔ gi yu wan alɛt klos funkshɔnaliti ɔtomɛtik wan. We yu lɔk wan alɛt, i de pul am na di DOM.

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

Fɔ mek yu alɛt dɛn yuz animashɔn we yu de klos, mek shɔ se dɛn gɛt di .fadeɛn .inklas dɛn we dɛn dɔn ɔlrɛdi aplay to dɛn.

Di we aw dɛn de du am

$().alert()

Mek wan alɛt lisin fɔ klik ivin dɛn pan disɛndant ɛlimɛnt dɛn we gɛt di data-dismiss="alert"atribyut. (Nɔ nid we yu de yuz di data-api in ɔto-initializashɔn.)

$().alert('close')

Klos wan alɛt bay we i pul am na di DOM. If di .fadeɛn .inklas dɛn de na di ɛlimɛnt, di alɛt go dɔn bifo dɛn pul am.

Di tin dɛn we kin apin

Bootstrap in alert plɔgin de ɛksplɔz sɔm ivin dɛn fɔ huk insay alert funkshɔnaliti.

Di kayn tin we apin Tɔk bɔt
klos.bs.alɛt fɔ di wan dɛn we de Dis ivent de faya wantɛm wantɛm we dɛn kɔl di closeinstans mɛtɔd.
klos.bs.alɛt Dis ivent de faya we di alɛt dɔn lɔk (go wet fɔ CSS transishɔn dɛn fɔ dɔn).
$('#myAlert').on('closed.bs.alert', function () {
  // do something…
})

Bɔtin dɛn bɔtin.js

Du mɔ wit bɔtin dɛn. Kɔntrol bɔtin de tɔk ɔ mek grup dɛn fɔ bɔtin fɔ mɔ kɔmpɔnɛnt dɛn lɛk tulba dɛn.

Krɔs-brauza kɔmpitibliti

Fayafaks de kɔntinyu fɔm kɔntrol stet dɛn (disabledness ɛn checkedness) akɔdin to pej lod dɛn . Wan we fɔ sɔlv dis na fɔ yuz autocomplete="off". Si Mozilla bɔg #654072 .

Stetful wan

Ad data-loading-text="Loading..."fɔ yuz wan lod stet na wan bɔtin.

Dis ficha nɔ de igen frɔm v3.3.5 ɛn dɛn dɔn pul am na v4.

Yuz ɛni stet we yu lɛk!

Fɔ di sake fɔ dis demonstreshɔn, wi de yuz data-loading-textɛn $().button('loading'), bɔt nɔto di wangren stet we yu kin yuz. Si mɔ bɔt dis dɔŋ ya na di $().button(string)dɔkyumentri .

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

Single toggle we yu de yuz

Add data-toggle="button"fɔ aktiv di toggling pan wan singl bɔtin.

Di bɔtin dɛn we dɛn dɔn chenj bifo tɛm nid .activeɛnaria-pressed="true"

Fɔ di bɔtin dɛn we dɛn dɔn chenj bifo tɛm, yu fɔ ad di .activeklas ɛn di aria-pressed="true"atribyut to di buttonyusɛf.

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

Chɛkbɔks / Redio

Ad data-toggle="buttons"to wan .btn-groupchɛkbɔks we gɛt ɔ redio input dɛn fɔ mek yu ebul fɔ tɔgl insay dɛn yon stayl dɛn.

Di opshɔn dɛn we dɛn dɔn pik bifo tɛm nid.active

Fɔ opshɔn dɛn we yu dɔn pik bifo tɛm, yu fɔ ad di .activeklas to di input’s labelyusɛf.

Visual checked state onli apdet pan klik

If di chɛk stet fɔ wan chɛkbɔks bɔtin ɔpdet we yu nɔ faya wan clickivin na di bɔtin (ɛgz. via <input type="reset">ɔ via sɛtin di checkedprɔpati fɔ di input), yu go nid fɔ tɔgl di .activeklas pan di input in yon label.

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

Di we aw dɛn de du am

$().button('toggle')

Toggles push stet. Gi di bɔtin di we aw i tan lɛk se dɛn dɔn aktiv am.

$().button('reset')

Riset bɔtin stet - swap tɛks to ɔrijinal tɛks. Dis we ya na asynchronous ɛn i de kam bak bifo di riset dɔn rili dɔn.

$().button(string)

Swap tɛks to ɛni data we dɛn dɔn difayn tɛks stet.

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

Kollaps kollaps.js

Fleksibul plɔgin we de yuz wan anful klas fɔ izi tɔgl bihayvya.

Dipɛnsin fɔ di plɔgin

Kollaps nid di transitions plɔgin fɔ de insay yu vɛshɔn fɔ Bootstrap.

Ɛgzampul

Klik di bɔtin dɛn we de dɔŋ fɔ sho ɛn ayd ɔda ɛlimɛnt bay we dɛn chenj di klas:

  • .collapsede ayd di tin dɛn we de insay
  • .collapsingna di tɛm we dɛn de chenj
  • .collapse.insho wetin de insay

Yu kin yuz wan link wit di hrefatribyut, ɔ wan bɔtin wit di data-targetatribyut. Insay dɛn tu kes ya, data-toggle="collapse"dɛn nid fɔ du di.

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>

Akkɔdin ɛgzampul

Ekstend di difɔlt kollaps bihayvya fɔ mek wan akodiɔn wit di panɛl kɔmpɔnɛnt.

Anim pariatur cliche reprehenderit, enim eiusmod ay layf akusum teri richardson ad squid. 3 wulf mun officia aute, nɔ cupidat sketbɔd dolor brunch. Trak fɔ it quinoa nesciunt laborum eiusmod. Brunch 3 wulf mun tempor, sunt aliqua put wan bɔd pan am squid singl-ɔrijin kɔfi nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, kraft bia laboure wes anderson kred nesciunt sapiente ea proident. Ad vegan ekseptɔr butcher vays lomo. Leggings occaecat kraft bia fam-to-tebul, raw denim aesthetic synth nesciunt yu probabli nɔ yɛri bɔt dɛn accusamus labore sataynabul VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ay layf akusum teri richardson ad squid. 3 wulf mun officia aute, nɔ cupidat sketbɔd dolor brunch. Trak fɔ it quinoa nesciunt laborum eiusmod. Brunch 3 wulf mun tempor, sunt aliqua put wan bɔd pan am squid singl-ɔrijin kɔfi nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, kraft bia laboure wes anderson kred nesciunt sapiente ea proident. Ad vegan ekseptɔr butcher vays lomo. Leggings occaecat kraft bia fam-to-tebul, raw denim aesthetic synth nesciunt yu probabli nɔ yɛri bɔt dɛn accusamus labore sataynabul VHS.
Anim pariatur cliche reprehenderit, enim eiusmod ay layf akusum teri richardson ad squid. 3 wulf mun officia aute, nɔ cupidat sketbɔd dolor brunch. Trak fɔ it quinoa nesciunt laborum eiusmod. Brunch 3 wulf mun tempor, sunt aliqua put wan bɔd pan am squid singl-ɔrijin kɔfi nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, kraft bia laboure wes anderson kred nesciunt sapiente ea proident. Ad vegan ekseptɔr butcher vays lomo. Leggings occaecat kraft bia fam-to-tebul, raw denim aesthetic synth nesciunt yu probabli nɔ yɛri bɔt dɛn accusamus labore sataynabul 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>

I posibul tu fo swap out .panel-bodys wit .list-groups.

  • Bootply fɔ di wan dɛn we de
  • Wan itmus ac fasilin
  • Sɛkɔn eros

Mek di ekspand/kollaps kɔntrol dɛn aksesbul

Mek shɔ se yu ad aria-expandedpan di kɔntrol ɛlimɛnt. Dis atribyut de difayn klia wan di stet we di kollapsbul ɛlimɛnt de naw fɔ skrin rida ɛn di sem kayn ɛp tɛnkɔlɔji dɛn. If di kollapsibl ɛlimɛnt dɔn lɔk bay difɔlt, i fɔ gɛt valyu we na aria-expanded="false". If yu dɔn sɛt di kɔlapsibl ɛlimɛnt fɔ opin bay difɔlt yuz di inklas, sɛt aria-expanded="true"pan di kɔntrol insted. Di plɔgin go ɔtomɛtik tɔgl dis atribyut bay we dɛn dɔn opin ɔ lɔk di ɛlimɛnt we dɛn kin kɔlap ɔ nɔ.

Apat frɔm dat, if yu kɔntrol ɛlimɛnt de tɔch wan singl kɔlapsibl ɛlimɛnt – dat na di data-targetatribyut de pɔynt to wan idsɛlɛktɔ – yu kin ad wan ɔda aria-controlsatribyut to di kɔntrol ɛlimɛnt, we gɛt di idɔf di kɔlapsibl ɛlimɛnt. Di mɔdan skrin rida dɛn ɛn di sem kayn ɛp tɛnkɔlɔji dɛn de yuz dis atribyut fɔ gi di wan dɛn we de yuz am ɔda sɔtkat dɛn fɔ go dairekt to di ɛlimɛnt sɛf we dɛn kin kol.

Aw fɔ yuz am

Di kollaps pl��gin de yuz sɔm klas dɛn fɔ handel di ebi liftin:

  • .collapsede ayd di tin dɛn we de insay
  • .collapse.insho di tin dɛn we de insay
  • .collapsingdɛn kin ad am we di chenj bigin, ɛn dɛn kin pul am we i dɔn

Yu kin fɛn dɛn klas ya na component-animations.less.

Via data atribyut dɛn

Jɔs ad data-toggle="collapse"ɛn a data-targetto di ɛlimɛnt fɔ ɔtomɛtik asaynd kɔntrol fɔ wan kollapsbul ɛlimɛnt. Di data-targetatribyut de aksept wan CSS sɛlɛktɔ fɔ aplay di kɔlapshɔn to. Mek shɔ se yu ad di klas collapseto di ɛlimɛnt we yu kin kɔlap. If yu want fɔ mek i opin difɔlt, ad di ɔda klas in.

Fɔ ad grup manejmɛnt we tan lɛk akɔdiɔn to wan kɔntrol we pɔsin kin kɔl, ad di data atribyut data-parent="#selector". Rif to di demo fɔ si dis in akshɔn.

Yu kin yuz JavaSkript fɔ yuz am

Enable manually wit:

$('.collapse').collapse()

Di tin dɛn we yu kin pik fɔ du

Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-, lɛk insay data-parent="".

Nem kayn balans tɔk bɔt
mama ɔ papa sɛlɛktɔ lay If dɛn gi wan sɛlɛktɔ, den ɔl di ɛlimɛnt dɛn we dɛn kin kɔl ɔnda di mama ɔ papa we dɛn dɔn spɛsifa go lɔk we dɛn sho dis tin we pɔsin kin kɔl. (similar to tradishonal akכdiכn bihayvya - dis de dipכnt pan di panelklas)
fɔ chenj di we aw dɛn de boolean we dɛn kɔl tru Toggles di kollapsibl elemɛnt pan invokeshɔn

Di we aw dɛn de du am

.collapse(options)

Aktiv yu kɔntinyu as wan ɛlimɛnt we pɔsin kin kɔlap. Aksept wan opshɔnal opshɔn dɛn object.

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

.collapse('toggle')

Toggles wan kollapsibl elemɛnt fɔ sho ɔ ayd. Ritɔn to di pɔsin we kɔl bifo di kɔlapsibl ɛlimɛnt dɔn rili sho ɔ ayd (dat na bifo di shown.bs.collapseɔ hidden.bs.collapseivin apin).

.collapse('show')

Sho wan ɛlimɛnt we pɔsin kin kɔlap. Ritɔn to di pɔsin we kɔl bifo di kɔlapsibl ɛlimɛnt dɔn rili sho (dat na bifo di shown.bs.collapseivin apin).

.collapse('hide')

I de ayd wan ɛlimɛnt we pɔsin kin kɔlap. Ritɔn to di pɔsin we kɔl bifo di kɔlapsibl ɛlimɛnt dɔn rili ayd (dat na bifo di hidden.bs.collapseivin apin).

Di tin dɛn we kin apin

Bootstrap in kollaps klas de ɛksplɔz sɔm ivintɛns fɔ huk insay kollaps funkshɔnaliti.

Di kayn tin we apin Tɔk bɔt
sho.bs.kɔlaps Dis ivent de faya wantɛm wantɛm we dɛn kɔl di showinstans mɛtɔd.
sho.bs.kɔlaps Dis ivent de faya we dɛn dɔn mek wan kollaps ɛlimɛnt fɔ si to di yuza (go wet fɔ CSS transishɔn dɛn fɔ dɔn).
ayd.bs.kollaps fɔ di wan dɛn we de Dis ivent de faya wantɛm wantɛm we hidedɛn dɔn kɔl di we aw dɛn de du am.
ayd.bs.kɔlaps Dis ivent de faya we dɛn dɔn ayd wan kollaps ɛlimɛnt frɔm di yuza (go wet fɔ mek CSS transishɔn dɛn dɔn).
$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something…
})

Karusel karusel.js

Wan slayd sho kɔmpɔnɛnt fɔ sayklis tru ɛlimɛnt dɛn, lɛk karusel. Nested carousels nɔ de sɔpɔt.

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

Kapshɔn dɛn we yu kin pik

Ad kapshɔn dɛn to yu slayd dɛn izi wan wit di .carousel-captionɛlimɛnt insay ɛni .item. Put jɔs lɛk ɛni opshɔnal HTML insay de ɛn i go ɔtomɛtik alaynɛd ​​ɛn fɔmat.

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

Bɔku bɔku karusel dɛn

Karusel nid fɔ yuz wan idpan di kɔntena we de na do (di .carousel) fɔ mek di karusel kɔntrol dɛn wok fayn fayn wan. We yu de ad bɔku bɔku karusel dɛn, ɔ we yu de chenj di karusel dɛn id, mek shɔ se yu ɔpdet di kɔntrol dɛn we gɛt fɔ du wit am.

Via data atribyut dɛn

Yuz data atribyut fɔ izi fɔ kɔntrol di pozishɔn fɔ di karusel. data-slideaksept di ki wɔd dɛn prevɔ next, we de chenj di say we di slayd de we yu kɔmpia am to di say we i de naw. Ɔda we de fɔ yuz data-slide-tofɔ pas wan raw slayd indeks to di karusel data-slide-to="2", we de chenj di say we di slayd de go to wan patikyula indeks we bigin wit 0.

Di data-ride="carousel"atribyut de yuz fɔ mak wan karusel as animat stat we pej lod. I nɔ go ebul fɔ yuz am togɛda wit (ridandant ɛn nɔ nid) ɛksplisit JavaSkript initializeshɔn fɔ di sem karusel.

Yu kin yuz JavaSkript fɔ yuz am

Kɔl karusel wit yu an wit:

$('.carousel').carousel()

Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-, lɛk insay data-interval="".

Nem kayn balans tɔk bɔt
intaval nɔmba 5000 pipul dɛn Di amount of taim fɔ delay bitwin ɔtomɛtik sayklis wan tin. If na lay, karusel nɔ go ɔtomɛtik saykl.
wet smɔl string fɔ di wan dɛn we de | nɔ gɛt wan valyu "hova" fɔ de. If dɛn sɛt am to "hover", i de stɔp di sayklis fɔ di karusel mouseenterɛn bigin bak di sayklis fɔ di karusel pan mouseleave. If yu sɛt am to null, fɔ hov oba di karusel nɔ go stɔp am.
rap boolean we dɛn kɔl tru If di karusel fɔ de saykl kɔntinyu ɔ i fɔ gɛt had stɔp dɛn.
kibɔd fɔ di kibɔd boolean we dɛn kɔl tru If di karusel fɔ riak to di tin dɛn we de apin na di kibɔd.

Initializes di carousel wit wan opshonal opshon objecten stat saikl tru tin dem.

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

Saykl dɛn tru di karusel tin dɛn frɔm lɛft to rayt.

Stɔp di karusel fɔ sayklɔs tru tin dɛn.

Saykl di karusel to wan patikyula freym (0 bays, we fiba wan arenjmɛnt).

Saykl dɛn to di tin we bin dɔn de bifo.

Saykl dɛn to di nɛks tin.

Bootstrap in karusel klas de ɛksplɔz tu ivintɛns fɔ huk insay karusel funkshɔnaliti.

Dɛn tu ivin dɛn ya gɛt dɛn ɔda prɔpati dɛn ya:

  • direction: Di dairekshɔn we di karusel de slayv (ɛither "left"ɔ "right").
  • relatedTarget: Di DOM elemɛnt we dɛn de slid insay ples as di aktiv aytem.

Ɔl di karusel ivin dɛn de faya na di karusel sɛf (dat na na di <div class="carousel">).

Di kayn tin we apin Tɔk bɔt
slayd.bs.karosel Dis ivent de faya wantɛm wantɛm we dɛn kɔl di slideinstans mɛtɔd.
slid.bs.karosel we de na di slid Dis ivent de faya we di karusel dɔn dɔn in slayd transishɔn.
$('#myCarousel').on('slide.bs.carousel', function () {
  // do something…
})

Affix affix.js fɔ di wan dɛn we de

Ɛgzampul

Di afiks plɔgin de tɔn position: fixed;ɛn ɔf, ɛn i de falamakata di ifɛkt we dɛn fɛn wit position: sticky;. Di sabnavigishɔn we de na di rayt say na layv dɛmo fɔ di afiks plɔgin.


Aw fɔ yuz am

Yuz di afiks plɔgin bay we yu yuz data atribyut dɛn ɔ yuz yu yon JavaSkript wit yu an. Insay ɔl tu di sityueshɔn dɛn, yu fɔ gi CSS fɔ di pozishɔn ɛn di wit we yu afiks kɔntinyu.

Notis: Nɔ yuz di afiks plɔgin pan ɛlimɛnt we de insay ɛlimɛnt we rili pozishɔn, lɛk kɔlɔm we dɛn pul ɔ push, bikɔs ɔf wan Safari rɛnda bɔg .

Pozishɔn bay CSS

Di afiks plɔgin de chenj bitwin tri klas dɛn, ɛn ɛni wan pan dɛn de sho wan patikyula stet: .affix, .affix-top, ɛn .affix-bottom. Yu fɔ gi di stayl dɛn, wit di ɛksɛpshɔn fɔ position: fixed;on .affix, fɔ dɛn klas ya yusɛf (indipɛndɛnt frɔm dis plɔgin) fɔ handle di aktual pozishɔn dɛn.

Na so di afiks plɔgin de wok:

  1. Fɔ stat, di plɔgin ad .affix-topfɔ sho se di ɛlimɛnt de na in ɔp-mɔst pozishɔn. Na dis tɛm no CSS pozishɔn nɔ nid fɔ de.
  2. Skrol pas di elemɛnt we yu want fɔ afiks fɔ mek di aktual afiks. Dis na di say we dɛn de .affixriples .affix-topɛn sɛt position: fixed;(we Bootstrap in CSS gi am).
  3. If dɛn dɔn difayn wan ɔfset we de dɔŋ, we yu skrol pas am fɔ chenj .affixwit .affix-bottom. Bikɔs ɔfset dɛn na opshɔnal, fɔ sɛt wan, yu fɔ sɛt di rayt CSS. If na so i bi, ad position: absolute;we nid de. Di plɔgin de yuz di data atribyut ɔ di JavaSkript opshɔn fɔ no usay fɔ put di ɛlimɛnt frɔm de.

Fɔ fala di step dɛn we de ɔp fɔ sɛt yu CSS fɔ ɛni wan pan di yuz opshɔn dɛn we de dɔŋ ya.

Via data atribyut dɛn

Fɔ ad afiks bihayvya izi wan to ɛni ɛlimɛnt, jɔs ad data-spy="affix"to di ɛlimɛnt we yu want fɔ spay pan. Yuz ɔfset fɔ difayn ustɛm fɔ tɔgl di pinin fɔ wan ɛlimɛnt.

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

Yu kin yuz JavaSkript fɔ yuz am

Kɔl di afiks plɔgin bay JavaSkript:

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

Di tin dɛn we yu kin pik fɔ du

Yu kin pas opshɔn dɛn bay we yu yuz data atribyut ɔ JavaSkript. Fɔ data atribyut dɛn, ad di opshɔn nem to data-, lɛk insay data-offset-top="200".

Nem kayn balans tɔk bɔt
ɔfset nɔmba | funkshɔn | tin 10. Di wan dɛn we de Piksɛl dɛn fɔ ɔfset frɔm skrin we yu de kɔlkul di pozishɔn fɔ skrol. If dɛn gi wan nɔmba, dɛn go yuz di ɔfset na ɔl tu di say dɛn we de ɔp ɛn dɔŋ. Fɔ gi yu wan, bɔt ɛn ɔp ɔfset jɔs gi wan tin offset: { top: 10 }ɔ offset: { top: 10, bottom: 5 }. Yuz wan fɛnshɔn we yu nid fɔ dinamik wan kɔlkyul wan ɔfset.
tagɛt sɛlɛktɔ | node na di | jKwɛri ɛlimɛnt di windowtin we dɛn de yuz Spɛsifikɛt di target ɛlimɛnt fɔ di afiks.

Di we aw dɛn de du am

.affix(options)

Aktiv yu kɔntinyu as affixed kɔntinyu. Aksept wan opshɔnal opshɔn dɛn object.

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

.affix('checkPosition')

Rikalkul di stet fɔ di afiks bay di dimɛnshɔn, pozishɔn, ɛn skrol pozishɔn fɔ di ɛlimɛnt dɛn we gɛt fɔ du wit am. Dɛn kin ad ɔ pul di .affix, .affix-top, ɛn klas dɛn pan di tin dɛn we dɛn dɔn afiks akɔdin to di nyu stet. .affix-bottomDis we fɔ du tin nid fɔ kɔl ɛni tɛm we dɛn chenj di dimɛnshɔn dɛn fɔ di kɔntinyu we dɛn afiks ɔ di ɛlimɛnt we dɛn want fɔ afɛkt, fɔ mek shɔ se dɛn put di kɔntinyu we dɛn afiks kɔrɛkt wan.

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

Di tin dɛn we kin apin

Bootstrap in afiks plɔgin de ɛksplɔz sɔm ivin dɛn fɔ huk insay afiks funkshɔnaliti.

Di kayn tin we apin Tɔk bɔt
afiks.bs.afiks Dis ivent de faya wantɛm wantɛm bifo dɛn dɔn afiks di ɛlimɛnt.
afiks.bs.afiks Dis ivent de faya afta dɛn dɔn afiks di ɛlimɛnt.
afiks-tɔp.bs.afiks Dis ivent de faya wantɛm wantɛm bifo dɛn dɔn afiks di ɛlimɛnt-tɔp.
afiks-tɔp.bs.afiks Dis ivent de faya afta di elemɛnt dɔn afiks-tɔp.
afiks-bɔt.bs.afiks Dis ivent de faya wantɛm wantɛm bifo di ɛlimɛnt dɔn afiks-bɔt.
afiks-bɔt.bs.afiks Dis ivent de faya afta di element don affix-bottom.