Botali ya mozindo

Moto na moto to oyo esangisi yango

Ba plugins ekoki kozala moko moko (kosalela ba *.jsfichiers moko moko ya Bootstrap), to nionso na mbala moko (kosalela bootstrap.jsto oyo ekitisami bootstrap.min.js).

Kosalela JavaScript oyo esangisi yango

Bango mibale bootstrap.jspe bazali bootstrap.min.jsna ba plugins nionso na fichier moko. Tyá mpe kaka moko.

Ba dépendances ya plugin

Ba plugins misusu na ba composants ya CSS etali ba plugins misusu. Soki otie ba plugins moko moko, sala makasi otala ba dépendances oyo na ba docs. Yeba pe que ba plugins nionso e dépend na jQuery (yango elakisi que jQuery esengeli ezala na kati liboso ya ba fichiers ya ba plugin). Consultez notrebower.json po omona ba versions nini ya jQuery ezo soutenir.

Ba attributs ya ba données

Okoki kosalela ba plugins nionso ya Bootstrap kaka na nzela ya API ya marquage sans kokoma ata ligne moko ya JavaScript. Oyo ezali API ya liboso ya Bootstrap mpe esengeli kozala likambo na yo ya liboso oyo osengeli kotalela ntango ozali kosalela plugin.

Yango elobami, na makambo mosusu ekoki kozala malamu kokanga fonctionnalité oyo. Yango wana, tozali mpe kopesa makoki ya kokanga API ya attribut ya ba données na ko délinger ba événements nionso na document namespaced na data-api. Oyo ezali komonana boye:

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

Na lolenge mosusu, mpo na ko cibler plugin moko ya sikisiki, kotia kaka kombo ya plugin lokola esika ya nkombo elongo na esika ya nkombo ya data-api lokola oyo:

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

Kaka plugin moko na élément moko na nzela ya ba attributs ya ba données

Kosalela te ba attributs ya ba données oyo ewutaka na ba plugins ebele na élément moko. Ndakisa, bouton ekoki te kozala na tooltip mpe kobalusa modal. Mpo na kokokisa yango, salelá eloko oyo batyaka na kati.

API ya programme

Tondimi mpe ete osengeli kozala na likoki ya kosalela ba plugins nyonso ya Bootstrap kaka na nzela ya API ya JavaScript. Ba API nionso ya leta ezali ba méthodes moko, oyo ekoki kozala na chaîne, mpe ezongisaka bosangisi oyo esalemaki na yango.

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

Ba méthodes nionso esengeli kondima objet ya ba options optionnelles, chaîne oyo ezo cibler méthode moko boye, to eloko moko te (oyo ebandisaka plugin na comportement par défaut):

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

Plugin moko na moko e exposer pe constructeur na yango brut na Constructorpropriété moko: $.fn.popover.Constructor. Soki olingi kozwa instance ya plugin moko boye, zwa yango mbala moko na élément moko: $('[rel="popover"]').data('popover').

Ba paramètres ya défaut

Okoki kobongola ba paramètres ya liboso ya plugin na kobongola Constructor.DEFAULTSeloko ya plugin:

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

Matata moko te

Tango mosusu esengeli kosalela ba plugins ya Bootstrap na ba cadres mosusu ya UI. Na makambo oyo, bokutani ya esika ya nkombo ekoki kobima ntango mosusu. Soki likambo yango esalemi, okoki kobenga .noConflictplugin oyo olingi kozongisa motuya na yango.

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

Makambo oyo esalemaki

Bootstrap epesaka ba événements personnalisés pona ba actions unique ya ba plugins mingi. Mingimingi, yango eyaka na lolenge ya infinitif mpe ya participe eleki - esika oyo infinitif (ex. show) ebandisami na ebandeli ya likambo moko, mpe lolenge na yango ya participe ya kala (ex. shown) ebandisami na bosilisi ya likambo moko.

Kobanda na 3.0.0, makambo nyonso ya Bootstrap ezali na esika ya nkombo.

Ba événements infinitifs nionso epesaka preventDefaultfonctionnalité. Yango epesaka makoki ya kopekisa exécution ya action moko avant ebanda.

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

Mituya ya ba versions

Version ya moko na moko ya ba plugins jQuery ya Bootstrap ekoki kozuama na nzela ya VERSIONpropriété ya constructeur ya plugin. Ndakisa, mpo na plugin ya tooltip:

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

Ba fallbacks ya sipesiale te tango JavaScript ezali désactivé

Ba plugins ya Bootstrap ezongaka sima te particulièrement gracement tango JavaScript ezali désactivé. Soki ozali komibanzabanza mpo na mayele ya mosaleli na likambo oyo, salelá <noscript>mpo na kolimbola likambo (mpe ndenge ya kofungola lisusu JavaScript) epai ya basaleli na yo, mpe/to kobakisa ba fallbacks na yo moko oyo olingi.

Babibliotɛkɛ ya bato mosusu

Bootstrap esungaka officiellement te ba bibliothèques ya JavaScript ya troisième partie lokola Prototype to jQuery UI. Malgré .noConflictmpe ba événements namespaced, ekoki kozala na ba problèmes ya compatibilité oyo esengeli o bongisa yo moko.

Ba transitions ya transition.js

Na ntina na mbongwana

Mpo na ba effets ya transition ya pete, kotia transition.jsmbala moko pembeni ya ba fichiers JS misusu. Soki ozali kosalela oyo esangisi (to oyo ekitisami) bootstrap.js, ntina ya kokɔtisa oyo ezali te —ezali deja wana.

Nini eza na kati

Transition.js ezali mosungi ya moboko mpo na transitionEndmakambo lokola mpe emulateur ya transition ya CSS. Esalelamaka na ba plugins mosusu mpo na kotala soki ezali na lisungi ya mbongwana ya CSS mpe mpo na kokanga ba transitions oyo ekangami.

Ko désactiver ba transitions

Ba transitions ekoki kozala désactivé na mokili mobimba na kosalelaka fragment ya JavaScript oyo elandi, oyo esengeli koya sima ya transition.js(to bootstrap.jsto bootstrap.min.js, ndenge ekoki kozala) e charger:

$.support.transition = false

Ba modɛlɛ modal.js

Ba modales ezali rationalisé, kasi flexible, ba prompts ya dialogue na fonctionnalité minimum oyo esengeli mpe ba défauts intelligents.

Ba modals ya polele ebele esimbami te

Sala makasi ofungola modal moko te tango mosusu ezali kaka komonana. Kolakisa ba modal koleka moko na mbala moko esengaka code personnalisé.

Placement ya marquage modale

Meka ntango nyonso kotia code HTML ya modal na esika ya nivo ya likolo na mokanda na yo mpo na koboya biloko mosusu oyo ezali na bopusi na lolenge ya komonana mpe/to mosala ya modal.

Ba caveats ya appareil mobile

Ezali na mwa ba caveats na oyo etali kosalela ba modal na ba appareils mobiles. Tala ba docs na biso ya soutien ya navigateur pona ba détails.

Na tina ya ndenge HTML5 elimbolaka sémantique na yango, autofocusattribut HTML ezali na effet moko te na ba modal ya Bootstrap. Mpo na kozwa eloko moko, salelá mwa JavaScript oyo olingi:

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

Bandakisa

Ndakisa ya statique

Modal oyo esalemi na motó, nzoto, mpe ensemble ya misala na nse ya lokasa.

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

Démonstration en direct

Toggle modal moko na nzela ya JavaScript na kofinaka bouton oyo ezali awa na nse. Ekokita mpe ekosila na kati longwa na likoló ya lokasa.

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

Sala ba modals accessibles

Kobosana te kobakisa role="dialog"mpe aria-labelledby="...", kosala référence na titre modal, na .modal, mpe role="document"na .modal-dialogyango moko.

En plus, okoki kopesa description ya dialogue modal na yo na aria-describedbyon .modal.

Kokɔtisa ba vidéos ya YouTube

Ko intégrer ba vidéos ya YouTube na ba modals esengaka JavaScript ya kobakisa te na Bootstrap pona ko arrêter automatiquement lecture pe ebele. Tala post oyo ya Stack Overflow ya lisungi mpo na koyeba makambo mosusu.

Ba taille oyo okoki kopona

Ba modales ezali na ba taille mibale ya option, oyo ezali na nzela ya ba classes ya modificateur oyo esengeli kotiama na .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 bs-example-modal-lg" 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 bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
      ...
    </div>
  </div>
</div>

Longola animation

Mpo na ba modal oyo emonanaka kaka na esika ya kosila mpo na kotala, longola .fadekelasi na bilembo na yo ya modal.

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

Kosalela système ya grille

Pona ko profiter na système ya grille Bootstrap na kati ya modal moko, kaka nest .rows na kati ya .modal-bodyet puis salela ba classes ya système ya grille normal.

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

Ozali na liboke ya ba boutons oyo nionso e déclencher modal moko, kaka na ba contenus un peu différent? Salelá event.relatedTargetmpe bizaleli ya HTMLdata-* (ekoki kozala na nzela ya jQuery ) mpo na kobongola makambo oyo ezali na kati ya modal engebene bouton nini obɛtaki. Tala ba docs ya Modal Events pona ba détails na relatedTarget, .

...ba boutons mosusu...
<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)
})

Kosalela yango

Plugin modal ebalusaka ba contenus na yo oyo ebombami na demande, na nzela ya ba attributs ya ba données to JavaScript. Ebakisi mpe .modal-openna <body>mpo na koboya bizaleli ya défilement par défaut mpe ebimisaka a .modal-backdropmpo na kopesa esika ya kofina mpo na koboya ba modal oyo elakisami ntango ozali kofina libanda ya modal.

Na nzela ya ba attributs ya ba données

Activer un modal sans kokoma JavaScript. Set data-toggle="modal"na élément ya contrôleur, lokola bouton, elongo na data-target="#foo"to href="#foo"mpo na ko cibler modal spécifique mpo na ko toggler.

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

Na nzela ya JavaScript

Benga modal na id myModalna ligne moko ya JavaScript:

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

Makambo oyo okoki kopona

Ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript. Mpo na ba attributs ya ba données, bakisa kombo ya option na data-, lokola na data-backdrop="".

Nkombo lolenge mbeba ndimbola
fond d’écran boolean to na molongo'static' ya solo Ezali na élément moko ya modal-backdrop. Na lolenge mosusu, lakisa staticmpo na fond d'écran oyo ekangaka te modal na clic.
clavier ya kosala boolean ya solo Ekangaka modal tango touche ya escape efinamaki
kolakisa boolean ya solo Ezali kolakisa modal tango ebandisami.
mosika nzela lokuta

Option oyo ezali déprecated banda v3.3.0 mpe elongolami na v4. Tosengi na esika na yango kosalela modèle ya côté client to cadre ya bokangami ya ba données, to kobenga jQuery.load yo moko.

Soki URL ya mosika epesami, makambo ekozala chargé mbala moko na nzela ya méthode ya jQuery loadmpe eko injecter na .modal-contentdiv. Soki ozali kosalela data-api, okoki kosalela na lolenge mosusu hrefattribut mpo na kolakisa source ya mosika. Ndakisa ya likambo yango emonisami awa na nse:

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

Ba méthodes ya kosala

Active contenus na yo lokola modal. Andimi ba options moko ya option object.

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

Manuellement ebalukaka modal moko. Ezongi na mobengi yambo modal elakisama to ebombama mpenza (elingi koloba liboso ete likambo shown.bs.modalto hidden.bs.modalesalema).

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

Manuellement efungolaka modal moko. Ezongi na mobengi yambo modal elakisama mpenza (elingi koloba liboso ete shown.bs.modallikambo esalema).

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

Manuellement abombaka modal moko. Ezongi na mobengi yambo ete modal ebombama mpenza (elingi koloba liboso ete hidden.bs.modallikambo esalema).

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

Ebongisaka lisusu positionnement ya modal mpo na ko contrer barre de défilement na cas moko esengeli ebima, oyo ekosala que modal epumbwa na gauche.

Esengeli kaka tango hauteur ya modal ebongwanaka tango ezali polele.

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

Makambo oyo esalemaki

Classe modal ya Bootstrap e exposer mua ba événements pona ko crochet na fonctionnalité modal.

Ba événements modaux nionso ezo betama na modal yango moko (c.a.d. na <div class="modal">).

Lolenge ya likambo Ndimbola
elakiseli.bs.modal Evenement oyo ezo beta mbala moko tango showméthode ya instance ebengami. Soki euti na kofina, eloko oyo obɛti ezali lokola relatedTargeteloko ya likambo.
elakisami.bs.modal Evenement oyo ezo beta tango modal esalemi visible na mosaleli (ekozela ba transitions ya CSS esila). Soki euti na kofina, eloko oyo obɛti ezali lokola relatedTargeteloko ya likambo.
kobomba.bs.modal Evenement oyo ezo beta mbala moko tango hideméthode ya instance ebengami.
ebombami.bs.modal Evenement oyo ezo beta tango modal esili kobombama na mosaleli (ekozela ba transitions ya CSS esila).
ekɔtisami.bs.modal Evenement oyo ezo beta tango modal a charger contenus en utilisant remoteoption.
$('#myModal').on('hidden.bs.modal', function (e) {
  // do something...
})

Ba dropdowns ya kokita.js

Bakisa ba menu ya kokita na pene na eloko nyonso na plugin oyo ya pete, bakisa mpe navbar, ba onglets, mpe ba pilili.

Na kati ya navbar moko

Na kati ya bankisi

Na nzela ya ba attributs ya ba données to JavaScript, plugin oyo ezali kokita ebalusaka makambo oyo ebombami (ba menu oyo ezali kokita) na kobongola .openkelasi na eloko ya liste ya baboti.

Na ba appareils mobiles, kofungola déroulant ebakisi esika .dropdown-backdropya kofina lokola esika ya kofina mpo na kokanga ba menu ya kokita ntango ozali kobɛta libanda ya menu, esengelami mpo na lisungi ya malamu ya iOS. Yango elingi koloba ete mpo na kolongwa na menu oyo ezali polele mpo na kokende na menu mosusu oyo ezali kokita, esɛngaka obɛta lisusu mingi na telefone ya mabɔkɔ.

Liyebisi: data-toggle="dropdown"Attribut etie motema mpo na kokanga ba menu ya kokita na niveau ya application, yango wana ezali likanisi malamu kosalela yango ntango nyonso.

Na nzela ya ba attributs ya ba données

Bakisa data-toggle="dropdown"na lien to na bouton mpo na kobongola esika oyo ezali kokita.

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

Mpo na kobatela ba URL ndenge moko na ba boutons ya lien, salelá data-targetattribut na esika ya 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>

Na nzela ya JavaScript

Benga ba dropdowns na nzela ya JavaScript:

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

data-toggle="dropdown"esɛngami naino

Indépendamment soki obengi dropdown na yo na nzela ya JavaScript to na esika na yango kosalela data-api, data-toggle="dropdown"esengeli ntango nyonso kozala présent na élément déclencheur ya dropdown.

Moko te

Ezali kobongola menu oyo ezali kokita ya navbar to navigation oyo ezali na onglet oyo epesami.

Ba événements nionso ya dropdown ezo betama na .dropdown-menuélément parent ya '.

Ba événements nionso ya kokita ezali na relatedTargetpropriété, oyo valeur na yango ezali élément anchor toggling.

Lolenge ya likambo Ndimbola
elakiseli.bs.kotika yango Evenement oyo ezo beta mbala moko tango méthode ya instance ya kolakisa ebengami.
elakisami.bs.kokita ya nse Evenement oyo ezo beta tango dropdown esalemi komonana na mosaleli (ekozela ba transitions ya CSS, mpo esila).
bomba.bs.oyo ezali kokita Evenement oyo ezo beta mbala moko tango méthode ya instance ya kobomba ebengami.
ebombami.bs.kokita ya nse Evenement oyo ezo beta tango dropdown esili kobombama na mosaleli (ekozela ba transitions ya CSS, mpo esila).
$('#myDropdown').on('show.bs.dropdown', function () {
  // do something…
})

ScrollSpy ezali scrollspy.js

Ndakisa na navbar

Plugin ScrollSpy ezali mpo na kosala mikolo oyo automatiquement ba cibles nav na kotalela position ya défilement. Défiler na esika oyo ezali na se ya navbar mpe tala mbongwana ya kelasi oyo ezali kosala. Ba sous-éléments oyo ezali kokita ekozala mpe na elembo.

@mafuta

Leggings ya publicité keytar, brunch id art fête dolor labore. Pitchfork yr enim lo-fi avant ba teka qui. Tumblr ferme-à-mesa ba droits ya vélo ezala nini. Anim keffiyeh carles cardigan na mokili ya lelo. Velit seitan kiosque ya ba photos ya mcsweeney 3 loup sanza irure. Cosby chandail lomo jean short, williamsburg hoodie minim qui mbala mosusu oyoki bango te et cardigan fonds de fidélité culpa biodiesel wes anderson esthétique. Nihil tatoué accusamus, cred ironie biodiesel keffiyeh artisan ullamco consequat.

@mdo

Veniam marfa moustache patin, adipisicing fugiat velit mandefu ya fourchette. Freegan mandefu aliqua cupidatat vero ya mcsweeney. Cupidatat minei loko nisi, ea helvetica nulla carles. Tatoué cosby chandail camion ya biloko ya kolia, mcsweeney ya quis non freegan vinyl. Lo-fi wes anderson +1 na nzoto ya moto. Carles exercice non esthétique quis gentrifier. Brooklyn adipisicing bière ya maboko vice keytar deserunt.

moko

Occaecat commodo oyo ezali na biloko ya kolya. Fap artisanat bière deserunt skateboard ea. Lomo vélo droits adipisicing banh mi, velit ea sunt niveau prochain locavore café d'origine unique na magna veniam. Vinyle id ya vie ya likolo, echo parc consequat quis aliquip banh mi fourchette. Vero VHS est ya kopanzana. Consectetur nisi bricolage minim sac de messagerie. Cred ex na, durable delectus consectetur fanny pack iphone.

mibale

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 sac ya messager marfa nini delectus camion ya biloko ya kolia. Sapiente synth id oyo ekanisami. Locavore sed helvetica cliche ironie, ba mbwa ya nkake oyo mbala mosusu oyoká bango te consequat hoodie sans gluten lo-fi fap aliquip. Labore elit placeat avant ba teka, terry richardson proident brunch nesciunt quis cosby chandail pariatur keffiyeh ut helvetica artisan. Cardigan bière artisanale seitan velit prêt. VHS chambray laboris ezali veniam ya ntango mokuse. Anim mollit minim commodo ullamco ba mbwa ya nkake.

Kosalela yango

Esengaka nav ya Bootstrap

Scrollspy esengi na tango oyo kosalela composant nav ya Bootstrap mpo na ko souligner malamu ya ba liens actifs.

Ba cibles ya ID oyo ekoki ko résoudre esengeli

Ba liens ya Navbar esengeli kozala na ba cibles id oyo ekoki ko résoudre. Ndakisa, a <a href="#home">home</a>esengeli ko correspondre na eloko moko na DOM lokola <div id="home"></div>.

Ba éléments :visibleoyo ezali cible te ba ignorer

Ba éléments cibles oyo ezali :visibleselon jQuery te ekozala ignorés mpe ba éléments nav correspondants na bango ekozala jamais souligné.

Esengaka positionnement relative

Ata méthode ya mise en œuvre, scrollspy esengaka kosalela position: relative;na élément oyo ozali espionnage na yango. Mbala mingi yango nde <body>. Ntango ozali kosala défilement na biloko mosusu oyo ezali te <body>, salá makasi ozala na heightensemble mpe overflow-y: scroll;osaleli yango.

Na nzela ya ba attributs ya ba données

Mpo na kobakisa na pete bizaleli ya scrollspy na navigation na yo ya topbar, bakisa data-spy="scroll"na élément oyo olingi kosala espionnage (mingi mingi oyo ekozala na <body>). Na sima bakisa data-targetattribut na ID to classe ya élément parent ya .navcomposant nionso ya Bootstrap.

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>

Na nzela ya JavaScript

Nsima ya kobakisa position: relative;na CSS na yo, benga scrollspy na nzela ya JavaScript:

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

Ba méthodes ya kosala

.scrollspy('refresh')

Ntango ozali kosalela scrollspy elongo na kobakisa to kolongola biloko na DOM, ekosɛnga obenga lolenge ya kozongisa sika lokola boye:

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

Makambo oyo okoki kopona

Ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript. Mpo na ba attributs ya ba données, bakisa kombo ya option na data-, lokola na data-offset="".

Nkombo lolenge mbeba ndimbola
offset ya kosala nimero 10 Ba pixels ya ko offset depuis likolo tango ya ko calculer position ya défilement.

Makambo oyo esalemaki

Lolenge ya likambo Ndimbola
kosala.bs.srollspy na mosala Evenement oyo ezo beta chaque fois que eloko ya sika ekomi activé na scrollspy.
$('#myScrollspy').on('activate.bs.scrollspy', function () {
  // do something…
})

Ba onglets oyo ekoki ko changer tab.js

Ndakisa ya ba onglets

Bakisa fonctionnalité ya tab ya mbangu, dynamique mpo na transition na nzela ya ba panneaux ya contenus local, ata na nzela ya ba menus déroulants. Ba onglets encastrés esimbami te.

Denim cru mbala mosusu oyoki bango te ba jean shorts Austin. Nesciunt tofu stumptown aliqua, bopeto ya masta ya synth rétro. Cliché ya moustache tempor, williamsburg carles helvetica ya vegan. Reprehenderit boucher rétro keffiyeh synth ya kokanga ndoto. Pull ya cosby eu banh mi, qui irure terry richardson ex calmar. Aliquip placeat salvia cillum na iphone. Seitan aliquip quis cardigan bilamba ya américain, boucher 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.

Ebakisaka navigation oyo ezali na ba onglets

Plugin oyo ebakisaka eteni ya navigation oyo ezali na ba onglets mpo na kobakisa bisika oyo ezali na ba onglets.

Kosalela yango

Activer ba onglets ya ba tabbables na nzela ya JavaScript (onglet moko na moko esengeli ko activer yango moko):

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

Okoki ko activer ba onglets moko moko na ba façons ebele:

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

Kosala bilembo

Okoki ko activer navigation ya onglet to ya pilili sans kokoma JavaScript moko te na ko préciser kaka data-toggle="tab"to data-toggle="pill"na élément moko. Kobakisa ba classes ya navmpe nav-tabsna tab ulekosalela styling ya tab Bootstrap , nzokande kobakisa ba classes navmpe nav-pillsekosalela styling ya pilili .

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

Effet ya kosila

Mpo na kosala ete ba onglets esila, bakisá .fadena mokomoko na yango .tab-pane. Panneau ya onglet ya liboso esengeli mpe kozala .inna kosala ete makambo ya ebandeli emonanaka.

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

Ba méthodes ya kosala

$().tab

Ezali ko activer élément ya onglet na conteneur ya contenus. Onglet esengeli kozala na soit a soit data-targetun hrefciblant node ya conteneur na DOM. Na bandakisa oyo ezali likolo, ba onglets ezali ba <a>s oyo ezali na ba data-toggle="tab"attributs.

.tab('show')

Pona tab oyo epesami mpe elakisaka makambo oyo ezali na boyokani na yango. Onglet mosusu nyonso oyo eponami liboso ekómaka oyo eponami te mpe makambo oyo etali yango ebombamaka. Ezongi na mobengi yambo ete esika ya tab elakisama mpenza (elingi koloba liboso ete shown.bs.tablikambo esalema).

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

Makambo oyo esalemaki

Ntango ozali kolakisa tab ya sika, makambo yango ekobeta na molɔngɔ oyo elandi:

  1. hide.bs.tab(na tab oyo ezali kosala lelo)
  2. show.bs.tab(na tab oyo esengeli kolakisa)
  3. hidden.bs.tab(na onglet actif ya liboso, ndenge moko na oyo ya hide.bs.tabévénement)
  4. shown.bs.tab(na tab oyo euti kolakisa sika oyo ezali kosala sika, ndenge moko na oyo ya show.bs.tablikambo yango)

Soki onglet moko te ezalaki déjà activé, alors ba événements hide.bs.tabmpe hidden.bs.tabekobeta te.

Lolenge ya likambo Ndimbola
lakisa.bs.tab Evenement oyo ezo beta na tab show, mais avant onglet ya sika elakisama. Salelá event.targetmpe mpo na event.relatedTargetko cibler onglet active mpe onglet active ya kala (soki ezali) respectivement.
elakisami.bs.tab Evenement oyo ezo beta na tab show sima ya tab moko elakisama. Salelá event.targetmpe mpo na event.relatedTargetko cibler onglet active mpe onglet active ya kala (soki ezali) respectivement.
bomba.bs.tab Evenement oyo ezo beta tango onglet ya sika esengeli kolakisa (et donc onglet actif ya kala esengeli kobombama). Salelá event.targetmpe event.relatedTargetmpo na kopesa motuya na tab oyo ezali kosala sikoyo mpe onglet ya sika oyo ekosalema kala mingi te, na kolanda.
ebombami.bs.tab Evenement oyo ezo beta sima ya onglet ya sika elakisami (mpe bongo onglet actif ya kala ebombami). Salelá event.targetmpe mpo na event.relatedTargetko cibler onglet active ya kala mpe onglet active ya sika, respectivement.
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  e.target // newly activated tab
  e.relatedTarget // previous active tab
})

Batoli ya bisaleli tooltip.js

Inspiré na plugin ya malamu mpenza ya jQuery.tipsy oyo ekomami na Jason Frame; Tooltips ezali version ya sika, oyo etie motema na bilili te, esalela CSS3 mpo na ba animations, mpe ba data-attributs mpo na kobomba titre ya esika.

Ba toli ya bisaleli oyo ezali na mitó ya makambo ya bolai zéro emonisami ata mokolo moko te.

Bandakisa

Botia maboko na ba liens oyo ezali awa na se mpo na komona ba toli ya bisaleli:

Pantalon serré niveau prochain keffiyeh probablement oyoki bango te. Photo cabine mandefu brut denim tipskrit sac messenger vegan stumptown. Ferme-à-mesa seitan, mcsweeney ya fixie durable quinoa 8-bit bilamba ya américain bazali na terry richardson vinyl chambray. Mandefu stumptown, cardigans banh mi lomo ba mbwa ya nkake. Tofu biodiesel williamsburg marfa, minei loko mcsweeney ya kosukola chambray vegan. Un vraiment artisan ironique quelque soit keytar , scenester ferme-à-mesa banksy Austin twitter manche freegan cred cru denim café d'origine unique viral.

Conseil d'outils statique

Ba options minei ezali: likolo, droite, na se, mpe gauche aligné.

Ba direction minei

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

Mosala ya kosala opt-in

Mpo na bantina ya bosali, Tooltip mpe Popover data-apis ezali opt-in, elingi koloba osengeli ko initialiser yango yo moko .

Lolenge moko ya ko initialiser ba toli nionso ya bisaleli na lokasa moko ekozala ya kopona yango na data-toggleattribut na yango:

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

Kosalela yango

Plugin ya tooltip ebimisaka contenus mpe marquage na demande, mpe par défaut etie ba tooltip sima ya élément ya déclencheur na bango.

Déclenchez tooltip na nzela ya JavaScript:

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

Kosala bilembo

Marquage oyo esengeli mpo na tooltip ezali kaka dataattribut mpe titlena élément HTML olingi kozala na tooltip. Marquage oyo esalemi ya tooltip ezali plutôt simple, atako esengaka position (par défaut, etiamaki na topna plugin).

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

Ba liens ya ba lignes ebele

Tango mosusu olingi kobakisa toli ya bisaleli na hyperlien oyo ezo envelopper ba lignes ebele. Comportement par défaut ya plugin ya tooltip ezali ya ko centrer yango horizontalement na verticalement. Bakisa white-space: nowrap;na ba ancres na yo po o éviter likambo oyo.

Ba toli ya bisaleli na bituluku ya ba boutons, bituluku ya bokoti, mpe ba tableaux esengaka bobongisi ya sipesiale

Ntango ozali kosalela makanisi ya bisaleli na biloko oyo ezali na kati ya a .btn-groupto an .input-group, to na biloko oyo etali tableau ( <td>, <th>, <tr>, <thead>, <tbody>, <tfoot>), ekosɛnga oyebisa nzela container: 'body'(ekomami awa na nse) mpo na koboya ba effets secondaires oyo olingi te (lokola eleman oyo ezali kokola mingi mpe/ to kobungisa ba coins na yango oyo ezali rond ntango nsɔngɛ ya bisaleli ebandi).

Koluka te kolakisa ba toli ya bisaleli na ba éléments oyo ebombami

Kobenga $(...).tooltip('show')tango élément cible ezali display: none;ekosala que tooltip ezala positionné na ndenge ya mabe.

Ba toli ya bisaleli oyo ekoki kozwama mpo na basaleli ya klaviatware mpe ya tekiniki ya kosunga

Mpo na basaleli oyo bazali kotambola na klaviatware, mpe mingimingi basaleli ya mayele ya kosalisa, osengeli kaka kobakisa makanisi ya bisaleli na biloko oyo ekoki kotya likebi na klaviatware lokola ba liens, ba contrôles ya formulaire, to eloko nyonso oyo ezali na tabindex="0"attribut.

Ba toli ya bisaleli na ba éléments oyo ekangami esengaka ba éléments ya enveloppe

Mpo na kobakisa tooltip na a disabledto .disabledélément, tia élément na kati ya a <div>mpe salela tooltip na yango na <div>esika na yango.

Makambo oyo okoki kopona

Ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript. Mpo na ba attributs ya ba données, bakisa kombo ya option na data-, lokola na data-animation="".

Nkombo Lolenge Mbeba Ndimbola
animation ya kosala boolean ya solo Salelá transition ya fade ya CSS na tooltip
eloko oyo batyaka na kati molongo ya molongo | lokuta lokuta

Ebakisi toli ya bisaleli na eloko moko ya sikisiki. Ndakisa: container: 'body'. Option oyo ezali surtout utile na ndenge epesaka yo nzela ya ko positionner tooltip na flux ya mokanda pene ya élément déclencheur - oyo ekopekisa tooltip e flotter mosika na élément déclencheur na tango ya changement ya taille ya fenêtre.

kozelisa motango | moto ya likambo 0.

Retard ya kolakisa pe kobomba tooltip (ms) - etali te lolenge ya déclencheur manuel

Soki nimero moko epesami, retard esalemi na nyonso mibale kobomba/lakisa

Bokeli ya eloko ezali:delay: { "show": 500, "hide": 100 }

html boolean lokuta Kotisa HTML na kati ya tooltip. Soki lokuta, méthode ya jQuery textekosalelama mpo na kokotisa makambo na DOM. Salelá makomi soki ozali komitungisa mpo na ba attaques ya XSS.
esika ya kotya yango molongo ya molongo | mosala 'likolo'

Ndenge nini ko positionner tooltip - likolo | na nse | na gauche | droite | auto.
Tango "auto" elakisami, eko réorienter dynamiquement tooltip. Ndakisa, soki placement ezali "auto gauche", tooltip ekolakisama na gauche soki likoki ezali, soki te ekolakisama na droite.

Tango fonction esalelami pona koyeba placement, ebengami na node DOM ya tooltip lokola argument na yango ya liboso mpe node DOM ya élément déclencheur lokola ya mibale na yango. Contexte thisetiamaki na instance ya tooltip.

moponi shene lokuta Soki moponi epesami, biloko ya tooltip ekopesama na ba cibles oyo elakisami. Na misala, yango esalelamaka mpo na kopesa nzela na makambo ya HTML oyo ezali na bomoi mpo na kozala na bilembo ya bisaleli oyo ebakisami. Talá oyo mpe ndakisa moko oyo ezali kopesa makambo mingi .
modèle ya kosala shene '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'

Base HTML ya kosalela tango ya kosala tooltip.

Ba tooltip's titleekozala injecté na kati ya .tooltip-inner.

.tooltip-arrowekokóma flèche ya tooltip.

Elemento ya enveloppe ya libanda esengeli kozala na .tooltipclasse.

titre molongo ya molongo | mosala '' .

Valeur ya titre par défaut soki titleattribut ezali te.

Soki fonction epesami, ekobenga yango na thisensemble ya référence na yango na élément oyo tooltip ekangami na yango.

kobandisa shene 'hover focus'. Ndenge nini tooltip ebandi - finá | kosala hover | focus | mokanda. Okoki koleka ba déclencheur ebele; kokabola bango na esika moko. manualekoki kosangisama te na déclencheur mosusu.
esika ya kotala molongo ya molongo | eloko | mosala { moponi: 'nzoto', padding: 0 }

Ebatelaka tooltip na kati ya ndelo ya élément oyo. Ndakisa: viewport: '#viewport'to{ "selector": "#viewport", "padding": 0 }

Soki fonction epesami, ebengami na node DOM ya élément déclencheur lokola argument na yango seul. Contexte thisetiamaki na instance ya tooltip.

Ba attributs ya ba données pona ba toli ya bisaleli moko moko

Ba options pona ba toli ya bisaleli moko moko ekoki na ndenge mosusu kozala précisé na nzela ya bosaleli ya ba attributs ya ba données, ndenge elimbolami likolo.

Ba méthodes ya kosala

$().tooltip(options)

Ezali kokangisa mosaleli ya tooltip na liboke ya biloko.

.tooltip('show')

Ezali kobimisa tooltip ya élément moko. Ezongi na mobengi yambo ete tooltip elakisama mpenza (elingi koloba liboso ete shown.bs.tooltiplikambo esalema). Yango etalelami lokola déclenchement "manuel" ya tooltip. Ba toli ya bisaleli oyo ezali na mitó ya makambo ya bolai zéro emonisami ata mokolo moko te.

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

.tooltip('hide')

Ebombaka tooltip ya élément moko. Ezongi na mobengi yambo ete tooltip ebombama mpenza (elingi koloba liboso ete hidden.bs.tooltiplikambo esalema). Yango etalelami lokola déclenchement "manuel" ya tooltip.

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

.tooltip('toggle')

Ezali kobongola toggle ya tooltip ya élément moko. Ezongi na mobengi yambo ete toli ya bisaleli elakisama to ebombama mpenza (elingi koloba liboso ete likambo shown.bs.tooltipto hidden.bs.tooltipesalema). Yango etalelami lokola déclenchement "manuel" ya tooltip.

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

.tooltip('destroy')

Ebombaka mpe ebebisaka tooltip ya élément moko. Ba toli ya bisaleli oyo esalela délégation (oyo esalemi na kosalelaka option selector) ekoki kobebisama moko moko te na ba éléments déclencheur descendant.

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

Makambo oyo esalemaki

Lolenge ya likambo Ndimbola
kolakisa.bs.toli ya bisaleli Evenement oyo ezo beta mbala moko tango showméthode ya instance ebengami.
oyo elakisami.bs.tooltip Evenement oyo ezo beta tango tooltip esalemi komonana na mosaleli (ekozela ba transitions ya CSS esila).
bomba.bs.likambo ya bisaleli Evenement oyo ezo beta mbala moko tango hideméthode ya instance ebengami.
ebombami.bs.tooltip ya bisaleli Evenement oyo ezo beta tango tooltip esili kobombama na mosaleli (ekozela ba transitions ya CSS esila).
ekotisami.bs.tooltip ya bisaleli Evenement oyo ezo beta sima ya show.bs.tooltipévénement tango modèle ya tooltip ebakisami na DOM.
$('#myTooltip').on('hidden.bs.tooltip', function () {
  // do something…
})

Ba popovers ba popover.js

Bakisa ba superpositions ya mike ya contenus, lokola oyo ezali na iPad, na élément nionso pona ko loger ba informations secondaires.

Ba Popovers oyo titre na yango na contenus na yango ezali na bolai ya zéro elakisami jamais.

Dépendance ya plugin

Popovers esengaka plugin ya tooltip ezala na kati ya version na yo ya Bootstrap.

Mosala ya kosala opt-in

Mpo na bantina ya bosali, Tooltip mpe Popover data-apis ezali opt-in, elingi koloba osengeli ko initialiser yango yo moko .

Lolenge moko ya ko initialiser ba popovers nionso na page moko ekozala pona yango na data-toggleattribut na yango:

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

Popovers na ba groupes ya ba boutons, ba groupes ya entrée, na ba tableaux esengaka réglage spécial

Ntango ozali kosalela ba popovers na ba éléments oyo ezali na kati ya a .btn-groupto an .input-group, to na ba éléments oyo etali tableau ( <td>, <th>, <tr>, <thead>, <tbody>, <tfoot>), ekosengela oyebisa option container: 'body'(ekomami awa na se) mpo na koboya ba effets secondaires oyo olingi te (lokola élément oyo ezali kokola mingi mpe/ to kobungisa ba coins na yango ya rond ntango popover ebandi).

Koluka te kolakisa ba popovers na ba éléments cachés

Kobenga $(...).popover('show')tango élément cible ezali display: none;ekosala que popover ezala positionné na ndenge ya mabe.

Popovers na ba éléments handicapés esengaka ba éléments ya enveloppe

Mpo na kobakisa popover na a disabledto .disabledélément, tia élément na kati ya a <div>mpe pakola popover na yango na <div>esika na yango.

Ba liens ya ba lignes ebele

Tango mosusu olingi kobakisa popover na hyperlien oyo ezo envelopper ba lignes ebele. Comportement par défaut ya plugin ya popover ezali ya ko centrer yango horizontalement na verticalement. Bakisa white-space: nowrap;na ba ancres na yo po o éviter likambo oyo.

Bandakisa

Popover ya statique

Ba options minei ezali: likolo, droite, na se, mpe gauche aligné.

Popover ya likolo

Sed posuere consectetur est na lobortis. Aenean eu leo ​​quam. Ornare péllentesque sem lacinia quam venenatis vestibulum.

Popover ezali bongo

Sed posuere consectetur est na lobortis. Aenean eu leo ​​quam. Ornare péllentesque sem lacinia quam venenatis vestibulum.

Popover na nse

Sed posuere consectetur est na lobortis. Aenean eu leo ​​quam. Ornare péllentesque sem lacinia quam venenatis vestibulum.

Popover alongwaki

Sed posuere consectetur est na lobortis. Aenean eu leo ​​quam. Ornare péllentesque sem lacinia quam venenatis vestibulum.

Démonstration en direct

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

Ba direction minei

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

Bolongola na clic oyo elandi

Salelá focusdéclencheur mpo na koboya ba popovers na clic oyo elandi oyo mosaleli azali kosala.

Marquage spécifique esengeli mpo na dismiss-on-next-click

Mpo na bizaleli malamu ya croix-navigateur mpe cross-plateforme, osengeli kosalela <a>tag, tag te , <button>mpe osengeli mpe kotia ba attributs role="button"mpe .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>

Kosalela yango

Bofungola ba popovers na nzela ya JavaScript:

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

Makambo oyo okoki kopona

Ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript. Mpo na ba attributs ya ba données, bakisa kombo ya option na data-, lokola na data-animation="".

Nkombo Lolenge Mbeba Ndimbola
animation ya kosala boolean ya solo Salelá transition ya fade ya CSS na popover
eloko oyo batyaka na kati molongo ya molongo | lokuta lokuta

Ebakisi popover na élément moko ya sikisiki. Ndakisa: container: 'body'. Option oyo ezali surtout utile na ndenge epesaka yo nzela ya ko positionner popover na flux ya document pene ya élément déclencheur - oyo ekopekisa popover e flotter mosika na élément déclencheur na tango ya changement ya taille ya fenêtre.

makambo eza na kati molongo ya molongo | mosala '' .

Valeur ya contenus par défaut soki data-contentattribut ezali te.

Soki fonction moko epesami, ekobenga yango na thisensemble ya référence na yango na élément oyo popover ekangami na yango.

kozelisa motango | moto ya likambo 0.

Retard ya kolakisa pe kobomba popover (ms) - etali te type ya déclencheur manuel

Soki nimero moko epesami, retard esalemi na nyonso mibale kobomba/lakisa

Bokeli ya eloko ezali:delay: { "show": 500, "hide": 100 }

html boolean lokuta Kotisa HTML na kati ya popover. Soki lokuta, méthode ya jQuery textekosalelama mpo na kokotisa makambo na DOM. Salelá makomi soki ozali komitungisa mpo na ba attaques ya XSS.
esika ya kotya yango molongo ya molongo | mosala 'malamu'

Ndenge nini ko positionner popover - likolo | na nse | na gauche | droite | auto.
Tango "auto" elakisami, eko réorienter dynamiquement popover. Ndakisa, soki placement ezali "auto gauche", popover ekolakisama na gauche soki likoki ezali, soki te ekolakisama na droite.

Tango fonction esalelami pona koyeba placement, ebengami na node popover DOM lokola argument na yango ya liboso pe élément déclencheur node DOM lokola ya mibale na yango. Contexte thisetiamaki na instance ya popover.

moponi shene lokuta Soki moponi epesami, biloko ya popover ekopesama na ba cibles oyo elakisami. Na pratique, yango esalelamaka pona ko permettre ba contenus HTML dynamiques ezala na ba popovers oyo ebakisami. Talá oyo mpe ndakisa moko oyo ezali kopesa makambo mingi .
modèle ya kosala shene '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'

Base HTML ya kosalela tango ya kosala popover.

Ba popover's titlebako injecter na kati ya .popover-title.

Ba popover's contentbako injecter na kati ya .popover-content.

.arrowekokoma flèche ya popover.

Elemento ya enveloppe ya libanda esengeli kozala na.popoverclasse.

titre molongo ya molongo | mosala '' .

Valeur ya titre par défaut sokititleattribut ezali te.

Soki fonction moko epesami, ekobenga yango na thisensemble ya référence na yango na élément oyo popover ekangami na yango.

kobandisa shene 'cliquez'. Ndenge nini popover ebandi - finá | kosala hover | focus | mokanda. Okoki koleka ba déclencheur ebele; kokabola bango na esika moko. manualekoki kosangisama te na déclencheur mosusu.
esika ya kotala molongo ya molongo | eloko | mosala { moponi: 'nzoto', padding: 0 }

Ezali kobatela popover na kati ya ndelo ya élément oyo. Ndakisa: viewport: '#viewport'to{ "selector": "#viewport", "padding": 0 }

Soki fonction epesami, ebengami na node DOM ya élément déclencheur lokola argument na yango seul. Contexte thisetiamaki na instance ya popover.

Ba attributs ya ba données pona ba popovers moko moko

Ba options pona ba popovers moko moko ekoki na ndenge mosusu kozala précisé na nzela ya bosaleli ba attributs ya ba données, ndenge elimbolami likolo.

Ba méthodes ya kosala

$().popover(options)

Initialise ba popovers pona collection ya élément.

.popover('show')

Ezali kobimisa popover ya élément moko. Ezongi na mobengi yambo popover elakisama mpenza (elingi koloba liboso ete shown.bs.popoverlikambo esalema). Yango etalelami lokola déclenchement "manuel" ya popover. Ba Popovers oyo titre na yango na contenus na yango ezali na bolai ya zéro elakisami jamais.

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

.popover('hide')

Ebombaka popover ya élément moko. Ezongi na mobengi yambo ete popover ebombama mpenza (elingi koloba liboso ete hidden.bs.popoverlikambo esalema). Yango etalelami lokola déclenchement "manuel" ya popover.

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

.popover('toggle')

Toggles popover ya élément moko. Ezongi na mobengi yambo popover elakisama to ebombama mpenza (elingi koloba yambo ete likambo shown.bs.popoverto hidden.bs.popoveresalema). Yango etalelami lokola déclenchement "manuel" ya popover.

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

.popover('destroy')

Ebombaka mpe ebebisaka popover ya élément moko. Popovers oyo esalela délégation (oyo esalemi na nzela ya selectoroption ) ekoki kobebisama moko moko te na ba éléments déclencheur descendant.

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

Makambo oyo esalemaki

Lolenge ya likambo Ndimbola
elakisaka.bs.popover Evenement oyo ezo beta mbala moko tango showméthode ya instance ebengami.
elakisami.bs.bobola Evenement oyo ezo beta tango popover esalemi visible na mosaleli (ekozela ba transitions ya CSS esila).
bomba.bs.bobola Evenement oyo ezo beta mbala moko tango hideméthode ya instance ebengami.
ebombami.bs.bobola Evenement oyo ezo beta tango popover esili kobombama na mosaleli (ekozela ba transitions ya CSS esila).
ekotisami.bs.bobola Evenement oyo ezo bengana sima ya show.bs.popoverévénement tango modèle ya popover ebakisami na DOM.
$('#myPopover').on('hidden.bs.popover', function () {
  // do something…
})

Ba messages ya alert alert.js

Ndakisa ya makebisi

Bakisa fonctionnalité ya démission na ba messages nionso ya alerte na plugin oyo.

Ntango ozali kosalela .closebouton, esengeli kozala mwana ya liboso ya .alert-dismissiblempe eloko moko te ya makomi ekoki koya liboso na yango na elembo.

Kosalela yango

Bakisa kaka data-dismiss="alert"na bouton na yo ya kokanga mpo na kopesa automatiquement fonctionnalité ya kokanga alerte. Kokanga alerte elongolaka yango na DOM.

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

Mpo na kosala ete ba alertes na yo esalela animation ntango ozali kokanga, sala ete ezala na .fadempe.in classes ya pe esi esalemi na bango

Ba méthodes ya kosala

$().alert()

Esalaka alerte koyoka ba événements ya clic na ba éléments descendants oyo ezali na data-dismiss="alert"attribut. (Ezali na ntina te ntango ozali kosalela auto-initialisation ya data-api.)

$().alert('close')

Ekangaka alerte na kolongola yango na DOM. Soki ba classes .fadempe .inezali na élément, alerte ekosila liboso ya kolongola yango.

Makambo oyo esalemaki

Plugin ya alerte ya Bootstrap e exposer mua ba événements pona ko crochet na fonctionnalité ya alerte.

Lolenge ya likambo Ndimbola
bokanga.bs.alerte Evenement oyo ezo beta mbala moko tango closeméthode ya instance ebengami.
ekangami.bs.alerte Evenement oyo ezo beta tango alerte ekangami (ekozela ba transitions ya CSS esila).
$('#myAlert').on('closed.bs.alert', function () {
  // do something…
})

Ba boutons bouton.js

Sala mingi na ba boutons. Bouton ya contrôle ezo loba to kosala ba groupes ya ba boutons pona ba composants ebele lokola ba barres d'outils.

Bokokani ya navigateur croisé

Firefox ewumeli na ba états ya contrôle ya formulaire (disabledness mpe checkedness) na kati ya ba charges ya page . Likambo ya kosilisa likambo yango ezali ya kosalela autocomplete="off". Tala likambo ya Mozilla #654072 .

Kozala na Leta

Bakisa data-loading-text="Loading..."mpo na kosalela état ya chargement na bouton moko.

Ezaleli oyo ezali déprecated banda v3.3.5 mpe elongolami na v4.

Salelá état oyo olingi!

Mpo na bolamu ya elakiseli oyo, tozali kosalela data-loading-textmpe $().button('loading'), kasi yango ezali kaka te etuka oyo okoki kosalela. Tala makambo mingi na ntina ya likambo oyo na nse na $().button(string)mikanda .

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

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

Toggle moko

Bakisa data-toggle="button"mpo na ko activer toggling na bouton moko.

Ba boutons pré-togglé esengeli .activempearia-pressed="true"

Mpo na ba boutons pré-togglé, esengeli obakisa .activeclasse mpe aria-pressed="true"attribut na buttonyo moko.

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

Boîte de coche / Radio

Bakisa data-toggle="buttons"na .btn-groupcase ya kotiya elembo oyo ezali na to ba entrées ya radio mpo na ko permettre toggling na ba styles na bango respectifs.

Ba options oyo oponi liboso esengeli.active

Mpo na ba options oyo oponi liboso, esengeli obakisa .activekelasi na oyo ya entrée labelyo moko.

Visual vérifié état kaka mise à jour na clic

Soki état marqué ya bouton ya case ya kotiya elembo ezali mise à jour sans ko tirer clickévénement na bouton (par exemple via <input type="reset">ou via setting la checkedpropriété ya entrée), ekosenga o changer .activeclasse na entrée's labelyo moko.

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

Ba méthodes ya kosala

$().button('toggle')

Toggles état ya kopusama. Epesaka bouton apparence que esili ko activer.

$().button('reset')

Ezongisaka état ya bouton - ebongoli makomi na makomi ya ebandeli. Méthode oyo ezali asynchrone mpe ezongaka avant réinitialisation esila vraiment.

$().button(string)

Echanger texte na état nionso ya texte oyo e définir na ba données.

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

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

Bopanzani collapse.js

Plugin flexible oyo esalelaka mwa ba classes pona comportement ya toggle facile.

Dépendance ya plugin

Collapse esengaka plugin ya ba transitions ezala na version na yo ya Bootstrap.

Ndakisa

Finá na ba boutons oyo ezali awa na nse mpo na kolakisa mpe kobomba eloko mosusu na nzela ya mbongwana ya kelasi:

  • .collapseebombaka makambo oyo ezali na kati
  • .collapsingesalelamaka na ntango ya mbongwana
  • .collapse.inelakisaka makambo oyo ezali na kati

Okoki kosalela lien oyo ezali na hrefattribut, to bouton oyo ezali na data-targetattribut. Na makambo nyonso mibale, data-toggle="collapse"esɛngami.

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>

Ndakisa ya accordéon

Bobakisa comportement ya collapse par défaut mpo na kosala accordéon na composant ya panneau.

Anim pariatur cliche reprehenderit, enim eiusmod bomoi ya likolo accusamus terry richardson ad calmar. 3 mbwa ya zamba sanza officia aute, non cupidat patin dolor brunch. Camion ya biloko ya kolia quinoa nesciunt laborum eiusmod. Brunch 3 mbwa ya zamba sanza tempor, sunt aliqua atie ndeke likolo na yango calmar café d'origine unique nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, mosala ya bière artisanat wes anderson cred nesciunt sapiente ea proident. Annonce vegan excepteur boucher vice lomo. Leggings occaecat bière artisanale ferme-à-mesa, brut denim esthétique synth nesciunt mbala mosusu oyoká te bango accusamus labore durable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod bomoi ya likolo accusamus terry richardson ad calmar. 3 mbwa ya zamba sanza officia aute, non cupidat patin dolor brunch. Camion ya biloko ya kolia quinoa nesciunt laborum eiusmod. Brunch 3 mbwa ya zamba sanza tempor, sunt aliqua atie ndeke likolo na yango calmar café d'origine unique nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, mosala ya bière artisanat wes anderson cred nesciunt sapiente ea proident. Annonce vegan excepteur boucher vice lomo. Leggings occaecat bière artisanale ferme-à-mesa, brut denim esthétique synth nesciunt mbala mosusu oyoká te bango accusamus labore durable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod bomoi ya likolo accusamus terry richardson ad calmar. 3 mbwa ya zamba sanza officia aute, non cupidat patin dolor brunch. Camion ya biloko ya kolia quinoa nesciunt laborum eiusmod. Brunch 3 mbwa ya zamba sanza tempor, sunt aliqua atie ndeke likolo na yango calmar café d'origine unique nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, mosala ya bière artisanat wes anderson cred nesciunt sapiente ea proident. Annonce vegan excepteur boucher vice lomo. Leggings occaecat bière artisanale ferme-à-mesa, brut denim esthétique synth nesciunt mbala mosusu oyoká te bango accusamus labore durable 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>

Ezali mpe possible ko swap out .panel-bodys na .list-groups.

  • Bobandi ya mosala
  • Moko na yango itmus ac facilin
  • Eros ya mibale

Salá ete ba contrôles ya expansion/collapse ezala accessible

Bozala sûr ya kobakisa aria-expandedna élément ya contrôle. Attribut oyo e définir explicitement état actuel ya élément collapsible na ba lecteurs d'écran na ba technologies d'assistance ya ndenge wana. Soki eloko oyo ekoki kokangama ekangami na ndenge ya libela, esengeli kozala na motuya ya aria-expanded="false". Soki otie élément collapsible ezala ouvert par défaut kosalela inclasse, tia aria-expanded="true"na contrôle na esika na yango. Plugin eko changer automatiquement attribut oyo selon soki élément collapsible efungolami to ekangami to te.

En plus, soki élément ya contrôle na yo ezali ko cibler élément moko collapsible – c’est-à-dire data-targetattribut ezali ko pointer na idsélecteur – okoki kobakisa aria-controlsattribut supplémentaire na élément de contrôle, oyo ezali na idya élément collapsible. Ba lecteurs d’écran ya mikolo oyo mpe ba technologies ya assistance ya ndenge wana esalelaka attribut oyo mpo na kopesa ba usagers ba raccourcis ya kobakisa mpo na ko naviguer directement na élément collapsible yango moko.

Kosalela yango

Plugin ya collapse esalelaka mua ba classes pona ko gérer levage ya kilo:

  • .collapseebombaka makambo oyo ezali na kati
  • .collapse.inelakisaka makambo oyo ezali na kati
  • .collapsingebakisami ntango mbongwana ebandi, mpe elongolami ntango esili

Bakelasi yango ekoki kozwama na component-animations.less.

Na nzela ya ba attributs ya ba données

Bakisa kaka data-toggle="collapse"na a data-targetna élément pona ko assigner automatiquement contrôle ya élément collapsible. Attribut data-targetendimi moponi ya CSS mpo na kosalela collapse na yango. Bozala sûr ya kobakisa classe collapsena élément collapsible. Soki olingi ete efungwama na ndenge ya liboso, bakisá kelasi ya kobakisa in.

Mpo na kobakisa boyangeli ya etuluku lokola accordéon na contrôle collapsible, bakisa attribut ya ba données data-parent="#selector". Tala démonstration po omona likambo oyo na action.

Na nzela ya JavaScript

Activer manuellement na:

$('.collapse').collapse()

Makambo oyo okoki kopona

Ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript. Mpo na ba attributs ya ba données, bakisa kombo ya option na data-, lokola na data-parent="".

Nkombo lolenge mbeba ndimbola
moboti moponi lokuta Soki moponi epesami, boye biloko nyonso oyo ekoki kokangama na nse ya moboti oyo elakisami ekokangama ntango eloko oyo ekoki kokangama ekolakisama. (ekokani na bizaleli ya bonkoko ya accordéon - yango etali panelkelasi)
kobongola makambo boolean ya solo Ebalusaka élément collapsible na invocation

Ba méthodes ya kosala

.collapse(options)

Active contenus na yo lokola élément collapsible. Andimi ba options moko ya option object.

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

.collapse('toggle')

Ezali kobongola eloko oyo ekoki kokangama mpo na kolakisa to kobombama. Ezongi na mobengi yambo ete eloko oyo ekoki kokangama ezala mpenza kolakisa to ebombama (elingi koloba liboso ete likambo shown.bs.collapseto hidden.bs.collapseesalema).

.collapse('show')

Ezali kolakisa eleman moko oyo ekoki kokangama. Ezongisaka na mobengi yambo ete eloko oyo ekoki kokangama elakisama mpenza (elingi koloba liboso ete shown.bs.collapselikambo esalema).

.collapse('hide')

Ebombaka eloko moko oyo ekoki kokangama. Ezongi na mobengi yambo ete eloko oyo ekoki kokangama ebombama mpenza (elingi koloba liboso ete hidden.bs.collapselikambo esalema).

Makambo oyo esalemaki

Classe ya collapse ya Bootstrap e exposer mua ba événements pona ko crochet na fonctionnalité ya collapse.

Lolenge ya likambo Ndimbola
elakiseli.bs.kokwea Evenement oyo ezo beta mbala moko tango showméthode ya instance ebengami.
elakisami.bs.kokwea Evenement oyo ezo beta tango élément ya collapse esalemi visible na mosaleli (ekozela ba transitions ya CSS esila).
kobomba.bs.kokwea Evenement oyo ebetamaka mbala moko tango hideméthode ebengami.
ebombami.bs.kokwea Evenement oyo ezo beta tango élément ya collapse ebombami na mosaleli (ekozela ba transitions ya CSS esila).
$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something…
})

Carrousel ya carosel.js

Composant ya diaporama mpo na kokende na velo na kati ya ba éléments, lokola carrousel. Ba carousels encadrés esimbami te.

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

Ba captions oyo okoki kopona

Bakisa ba captions na ba diapositives na yo facilement na .carousel-captionélément na kati ya nionso .item. Tia kaka pene na HTML nionso ya option na kati kuna mpe ekozala automatiquement aligné mpe formaté.

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

Ba carrousels ebele

Ba carousel esengaka kosalela an idna récipient ya libanda mingi (le .carousel) mpo ba contrôles ya carousel esala malamu. Ntango ozali kobakisa ba carousel ebele, to ntango ozali kobongola oyo ya carousel id, kobosana te kosala mikolo oyo ba contrôles oyo etali yango.

Na nzela ya ba attributs ya ba données

Salelá ba attributs ya ba données mpo na ko contrôler facilement position ya carrousel. data-slideendimaka maloba ya ntina prevto next, oyo ebongoli esika ya diapositive na kotalela esika oyo ezali sikoyo. Na lolenge mosusu, salelá data-slide-tompo na koleka index ya diapositive brut na carousel data-slide-to="2", oyo ebongoli esika ya diapositive na index moko boye oyo ebandi na 0.

Attribut data-ride="carousel"esalelamaka mpo na kotya elembo na carousel lokola animateur kobanda na chargement ya lokasa. Ekoki kosalelama te elongo na (redundante mpe oyo ezali na ntina te) initialisation explicite ya JavaScript ya carousel moko.

Na nzela ya JavaScript

Benga carousel na maboko na:

$('.carousel').carousel()

Ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript. Mpo na ba attributs ya ba données, bakisa kombo ya option na data-, lokola na data-interval="".

Nkombo lolenge mbeba ndimbola
intervalle ya kosala nimero 5000 ya bato Motango ya ntango oyo esengeli kozongisa nsima kati na kotambola na velo na eloko moko na ndenge ya automatique. Soki lokuta, carrousel ekosala cycle automatiquement te.
kopema molongo ya molongo | ntina te "kosala hover". Soki otie yango na "hover", ezo pause na cycle ya carrousel na mouseenterpe ezongelaka cycle ya carousel na mouseleave. Soki otye yango na null, kopumbwa likoló ya carousel ekopemisa yango te.
kokanga boolean ya solo Ezala carrousel esengeli kosala cycle continuellement to kozala na ba arrêts ya makasi.
clavier ya kosala boolean ya solo Soki carousel esengeli e réagir na ba événements ya clavier.

Initialiser carrousel na options optionnelles objectmpe abandi ko cycler na nzela ya biloko.

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

Ezali kosala cycle na kati ya biloko ya carrousel kobanda na lobɔkɔ ya mwasi tii na lobɔkɔ ya mobali.

Epekisaka carrousel ekende na velo na nzela ya biloko.

Ezali kosala cycle ya carousel na cadre moko boye (0 basé, ndenge moko na array).

Ba cycles na eloko oyo eleki.

Ezali kosala ba cycles tii na eloko oyo elandi.

Classe ya carrousel ya Bootstrap e exposer deux événements pona ko crochet na fonctionnalité ya carrousel.

Ba événements nionso mibale ezali na ba propriétés ya kobakisa oyo elandi:

  • direction: Nzela oyo carrousel ezali kogumbama (soit "left"to "right").
  • relatedTarget: Elemento ya DOM oyo ezali ko glisser na esika lokola eloko ya active.

Ba événements nionso ya carrousel ebetamaka na carrousel yango moko (c.a.d. na <div class="carousel">).

Lolenge ya likambo Ndimbola
diapositive.bs.carousel ya kosala Evenement oyo ezo beta mbala moko tango slideméthode ya instance ezo invoquer.
glissement.bs.carousel ya kosala Evenement oyo ebetamaka tango carrousel esili kosala transition na yango ya diapositive.
$('#myCarousel').on('slide.bs.carousel', function () {
  // do something…
})

Bokanga affix.js

Ndakisa

Plugin ya affixe efungolaka position: fixed;mpe ekangamaka, emulaka effet oyo ezwami na position: sticky;. Sous-navigation oyo ezali na droite ezali démonstration en direct ya plugin ya affix.


Kosalela yango

Salelá plugin ya affix na nzela ya ba attributs ya ba données to manuellement na JavaScript na yo moko. Na ba situations nionso mibale, esengeli opesa CSS pona positionnement na largeur ya contenus na yo oyo ekangami.

Liyebisi: Kosalela te plugin ya affix na élément oyo ezali na kati ya élément oyo ezali relativement positionné, lokola colonne oyo ebendami to oyo epusami, mpo na bug ya rendu ya Safari .

Positionnement na nzela ya CSS

Plugin ya affixe ebalukaka kati na bakelasi misato, moko na moko ezali komonisa ezalela moko boye: .affix, .affix-top, mpe .affix-bottom. Esengeli opesa ba styles, longola kaka position: fixed;on .affix, mpo na ba classes oyo yo moko (indépendant ya plugin oyo) mpo na ko gérer ba positions ya solo.

Tala ndenge plugin ya affix esalaka:

  1. Mpo na kobanda, plugin ebakisi .affix-topmpo na kolakisa ete eloko yango ezali na esika na yango ya likoló mpenza. Na esika oyo positionnement ya CSS esengeli te.
  2. Kosala défilement koleka élément oyo olingi ko affixer esengeli ko déclencher fixation ya solo. Oyo ezali esika .affixezo remplacer .affix-toppe ezo set position: fixed;(epesami na CSS ya Bootstrap).
  3. Soki offset ya nse elimbolami, kosala défilement koleka yango esengeli kozwa esika na yango .affixna .affix-bottom. Lokola ba offsets ezali optionnel, ko setting moko esengi yo o setting CSS oyo ebongi. Na likambo yango, bakisá position: absolute;ntango esengeli. Plugin esalela attribut ya ba données to option JavaScript pona koyeba esika nini esengeli ko positionner élément depuis kuna.

Landa ba étapes oyo ezali likolo pona ko setting CSS na yo pona moko ya ba options ya usage oyo ezali awa na se.

Na nzela ya ba attributs ya ba données

Pona kobakisa facilement comportement ya affix na élément nionso, bakisa kaka data-spy="affix"na élément oyo olingi o espionner. Salelá ba offsets mpo na kolimbola ntango nini kobongola pinning ya eleman moko.

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

Na nzela ya JavaScript

Benga plugin ya affix na nzela ya JavaScript:

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

Makambo oyo okoki kopona

Ba options ekoki koleka na nzela ya ba attributs ya ba données to JavaScript. Mpo na ba attributs ya ba données, bakisa kombo ya option na data-, lokola na data-offset-top="200".

Nkombo lolenge mbeba ndimbola
offset ya kosala motango | mosala | moto ya likambo 10 Ba pixels ya ko décoller na écran tango ya ko calculer position ya défilement. Soki motángo moko epesami, offset ekosalema na ngámbo ya likoló mpe ya nse. Mpo na kopesa offset moko ya kokamwa, ya nse mpe ya likoló kopesa kaka eloko moko offset: { top: 10 }to offset: { top: 10, bottom: 5 }. Salelá fonction ntango osengeli kosala calcul dynamique ya offset.
eloko bazokana moponi | node | Elemento ya jQuery windoweloko yango Ezali kolakisa eleman ya cible ya affixe.

Ba méthodes ya kosala

.affix(options)

Active contenus na yo lokola contenus affixé. Andimi ba options moko ya option object.

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

.affix('checkPosition')

Ezali kosala lisusu calcul ya état ya affixe na kotalela ba dimensions, position, mpe position ya défilement ya ba éléments oyo etali yango. Ba .affix, .affix-top, mpe .affix-bottombakelasi ebakisami to elongolami na makambo oyo ekangami engebene ezalela ya sika. Esengeli kobenga méthode oyo tango nionso ba dimensions ya contenus oyo ekangami to élément cible ebongwanaka, pona ko assurer positionnement correct ya contenus oyo ekangami.

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

Makambo oyo esalemaki

Plugin ya affix ya Bootstrap e exposer mua ba événements pona ko crochet na fonctionnalité ya affix.

Lolenge ya likambo Ndimbola
affix.bs.kokanga yango Evenement oyo ezo beta mbala moko avant élément ezala fixé.
ekangami.bs.affix Evenement oyo ezo beta sima ya élément ezala fixé.
affix-likolo.bs.affix Evenement oyo ezo beta mbala moko avant élément ezala affixé-top.
ekangami-likolo.bs.affix Evenement oyo ezo beta sima ya élément ezala affixé-top.
affix-na nse.bs.affix Evenement oyo ezo beta mbala moko avant élément ezala affixé-bottom.
ekɔtisami-na nse.bs.affix Evenement oyo ezo beta sima ya élément ezala affixé-bottom.