JavaScript ezali

Mema ba composants ya Bootstrap na bomoi —sikawa na ba plugins 13 ya jQuery personnalisé.

Mitó likoló! Ba docs oyo ezali pona v2.3.2, oyo ezali lisusu officiellement soutenu te. Tala version ya sika ya Bootstrap!

Moto na moto to oyo esangisi yango

Ba plugins ekoki kozala na kati moko moko (atako misusu esengelaki na ba dépendances), to nionso na mbala moko. bootstrap.js mpe bootstrap.min.js nyonso mibale ezali na ba plugins nyonso na fichier moko.

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 classe ya liboso ya Bootstrap mpe esengeli kozala considération na yo ya liboso tango 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 body namespaced na `'data-api'`. Oyo ezali komonana boye:

  1. $ ( 'nzoto' ). off ( '.api ya ba données' ) .

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:

  1. $ ( 'nzoto' ). off ( '.alert.data-api' ) Ezali ndenge moko na ba .

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.

  1. $ ( ".btn.likama" ). bouton ( "kobongola" ). addClass ( "mafuta" ) .

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

  1. $ ( "#Modal na ngai" ). modal () // ebandisami na ba défauts
  2. $ ( "#Modal na ngai" ). modal ({ clavier : lokuta }) // ebandisami na clavier te
  3. $ ( "#Modal na ngai" ). modal ( 'lakisa' ) // ebandisaka mpe ebengaka kolakisa mbala moko

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

Matata ezali 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.

  1. var Bouton ya bootstrap = $ . fn . bouton . noConflict () // zongisa $.fn.button na motuya oyo bapesaki liboso
  2. $ . fn . bootstrapBtn = Bouton ya bootstrap // pesa $().bootstrapBtn fonctionnalité ya bootstrap

Makambo oyo esalemaki

Bootstrap epesaka ba événements personnalisés mpo na mingi ya ba actions unique ya plugin. En général, oyo eyaka na forme ya infinitif na ya participe passé - esika infinitif (ex. show) e déclenché na ebandeli ya événement, pe forme na yango ya participle ya kala (ex. shown) e déclenché na complétion ya action.

Ba événements nionso ya infinitif epesaka fonctionnalité ya preventDefault. Yango epesaka makoki ya kopekisa exécution ya action moko avant ebanda.

  1. $ ( '#Modal na ngai' ). na ( 'lakisa' , mosala ( e ) {
  2. soki (! ba données ) ezongisa e . preventDefault () // epekisaka modal kolakisa
  3. }) .

Na ntina na mbongwana

Mpo na ba effets ya transition ya pete, kotia bootstrap-transition.js mbala moko pembeni ya ba fichiers JS misusu. Soki ozali kosalela bootstrap.js oyo esangisami (to oyo ekómi moke) , ezali na ntina te ya kotya oyo —ezali deja wana.

Salelá ba cas

Mwa bandakisa ya plugin ya mbongwana:

  • Kokita to kokita na ba modal
  • Kosilisa ba onglets
  • Kosila ba alertes
  • Ba panneaux ya carrousel oyo ezali kogumbama

Bandakisa

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

Ndakisa ya statique

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

  1. <div class = "bombami ya modal kosila" >
  2. <div class = "motó ya-modal" >
  3. < lolenge ya bouton = "bouton" classe = "kokanga" data-dismiss = "modal" aria-hidden = "solo" > × </bouton>
  4. <h3> Motó ya likambo ya modɛlɛ </h3>
  5. </div>
  6. <div classe = "nzoto-modale" >
  7. <p> Nzoto moko ya malamu... </p>
  8. </div>
  9. <div class = "modali-moda ya nse ya lokasa" >
  10. <a href = "#" kelasi = "btn" > Bokanga </a>
  11. <a href = "#" class = "btn btn-primary" > Bomba mbongwana </a>
  12. </div>
  13. </div>

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.

  1. <!-- Bouton ya ko déclencher modal -->
  2. <a href = "#myModal" role = "bouton" classe = "btn" data-toggle = "modal" > Bobandi modal ya démonstration </a>
  3.  
  4. <!-- Modal -->
  5. <div id = "myModal" class = "modal bomba fade" tabindex = "-1" rôle = "dialogue" aria-labelledby = "myModalLabel" aria-bombami = "solo" >
  6. <div class = "motó ya-modal" >
  7. < lolenge ya bouton = "bouton" classe = "kokanga" data-dismiss = "modal" aria-hidden = "solo" > × </bouton>
  8. <h3 id = "myModalLabel" > Motó ya likambo ya modɛlɛ </h3>
  9. </div>
  10. <div classe = "nzoto-modale" >
  11. <p> Nzoto moko ya malamu... </p>
  12. </div>
  13. <div class = "modali-moda ya nse ya lokasa" >
  14. <bouton classe = "btn" data-dismiss = "modal" aria-hidden = "solo" > Kanga </bouton>
  15. <button class = "btn btn-primary" > Bomba mbongwana </button>
  16. </div>
  17. </div>

Kosalela yango

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.

  1. < lolenge ya bouton = "bouton" data-toggle = "modal" data-target = "#myModal" > Bobandi ya modal </button>

Na nzela ya JavaScript

Benga modal na id myModalna ligne moko ya JavaScript:

  1. $ ( '#Modal na ngai' ). modal ( ba 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 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

Soki url ya mosika epesami, makambo ekozwama na nzela ya loadméthode ya jQuery mpe ekokɔtisama na .modal-body. Soki ozali kosalela api ya ba données, okoki na ndenge mosusu kosalela hreftag mpo na kolakisa source ya mosika. Ndakisa ya likambo yango emonisami awa na nse:

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

Ba méthodes ya kosala

.modal(ba options) .

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

  1. $ ( '#Modal na ngai' ). modal ({
  2. clavier : lokuta
  3. }) .

.modal('kobongola')

Manuellement ebalukaka modal moko.

  1. $ ( '#Modal na ngai' ). modal ( 'kobongola' ) .

.modal('lakisa') .

Manuellement efungolaka modal moko.

  1. $ ( '#Modal na ngai' ). modal ( 'lakisa' ) .

.modal('bomba') .

Manuellement ebombaka modal moko.

  1. $ ( '#Modal na ngai' ). modal ( 'bomba' ) .

Makambo oyo esalemaki

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

Likambo Ndimbola
kolakisa Evenement oyo ezo beta mbala moko tango showméthode ya instance ebengami.
oyo emonisami Evenement oyo ezo beta tango modal esalemi visible na usager (ekozela ba transitions ya css esila).
kobombana Evenement oyo ezo beta mbala moko tango hideméthode ya instance ebengami.
ya kobombana Evenement oyo ezo beta tango modal esili kobombama na mosaleli (ekozela ba transitions ya css esila).
  1. $ ( '#Modal na ngai' ). na ( 'ebombami' , mosala () {
  2. // sala eloko moko...
  3. }) .

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

Na nzela ya ba attributs ya ba données

Pona kobakisa facilement comportement scrollspy na navigation na yo ya topbar, bakisa kaka data-spy="scroll"na élément oyo olingi o espionner (mingi mingi oyo ekozala nzoto) pe data-target=".navbar"pona nav nini okosalela. Okolinga kosalela scrollspy na .navcomposant moko.

  1. <nzoto data-spy = "kosala défilement" data-cible = ".navbar" > ... </body>

Na nzela ya JavaScript

Benga scrollspy na nzela ya JavaScript:

  1. $ ( '#navbar' ). scrollspy () .
Mitó likoló! Ba liens ya Navbar esengeli kozala na ba cibles id oyo ekoki ko résoudre. Na ndakisa, a <a href="#home">home</a>esengeli kokokana na eloko moko oyo ezali na dom lokola <div id="home"></div>.

Ba méthodes ya kosala

.scrollspy('kozongisa sika')

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

  1. $ ( '[espion-données="kosala défilement"]' ). moko na moko ( mosala () { .
  2. var $spy = $ ( oyo ). scrollspy ( 'kozongisa sika' ) .
  3. });

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

Likambo Ndimbola
kosala mosala Evenement oyo ezo beta chaque fois que eloko ya sika ekomi activé na scrollspy.

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.

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.


Kosalela yango

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

  1. $ ( '#Tab na ngai a' ). finá ( mosala ( e ) { .
  2. e . kopekisaDefault ();
  3. $ ( oyo ). tab ( 'lakisa' );
  4. }) .

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

  1. $ ( '#Tab na ngai a[href="#profil"]' ). tab ( 'lakisa' ); // Pona tab na kombo
  2. $ ( '#Tab na ngai a:ya liboso' ). tab ( 'lakisa' ); // Pona tab ya liboso
  3. $ ( '#Tab na ngai a:ya nsuka' ). tab ( 'lakisa' ); // Pona tab ya suka
  4. $ ( '#Tab na ngai li:eq(2) a' ). tab ( 'lakisa' ); // Pona tab ya misato (0-indexé)

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 mpe na onglet navekosalela styling ya onglet Bootstrap.nav-tabsul

  1. <ul classe = "nav nav-tabs" >
  2. <li><a href = "#ndako" data-toggle = "tab" > Ndako </a></li>
  3. <li><a href = "#profil" data-toggle = "onglet" > Profil </a></li>
  4. <li><a href = "#messages" data-toggle = "tab" > Ba sango </a></li>
  5. <li><a href = "#bobongisi" data-toggle = "tab" > Bobongisi </a></li>
  6. </ul>

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.

  1. <ul classe = "nav nav-tabs" id = "Onglet na ngai" >
  2. <li class = "active" ><a href = "#ndako" > Ndako </a></li>
  3. <li><a href = "#profil" > Profil </a></li>
  4. <li><a href = "#messages" > Ba messages </a></li>
  5. <li><a href = "#bobongisi" > Bobongisi </a></li>
  6. </ul>
  7.  
  8. <div class = "makambo ya tab" >
  9. <div class = "tab-pane ezali kosala" id = "ndako" > ... </div>
  10. <div class = "tab-pane" id = "profil" > ... </div>
  11. <div class = "tab-pane" id = "ba messages" > ... </div>
  12. <div class = "tab-pane" id = "ba paramètres" > ... </div>
  13. </div>
  14.  
  15. <script>
  16. $ ( mosala () { .
  17. $ ( '#Tab na ngai a:ya nsuka' ). tab ( 'lakisa' );
  18. }) .
  19. </script>

Makambo oyo esalemaki

Likambo Ndimbola
kolakisa 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.
oyo emonisami 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.
  1. $ ( 'a[kobongola-ba-donnée="tab"]' ). na ( 'elakisami' , mosala ( e ) {
  2. e . cible // onglet activé
  3. e . relatedTarget // onglet ya kala
  4. }) .

Bandakisa

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.

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

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.

Ba direction minei

Ba toli ya bisaleli na bituluku ya bokoti

Ntango ozali kosalela ba toli ya bisaleli mpe ba popovers na bituluku ya bokɔti ya Bootstrap, ekosɛnga otya containeroption (oyo ekomami awa na nse) mpo na koboya ba effets secondaires oyo olingi te.


Kosalela yango

Déclenchez tooltip na nzela ya JavaScript:

  1. $ ( '#ndakisa' ). tooltip ( ba 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 kosalela transition ya css fade na tooltip
html boolean lokuta Kotisa html na kati ya tooltip. Soki lokuta, méthode ya jquery textekosalelama pona ko kotisa contenus 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 | malamu
moponi shene lokuta Soki moponi epesami, biloko ya tooltip ekopesama na ba cibles oyo elakisami.
titre molongo ya molongo | mosala '' . motuya ya titre ya liboso soki tag `title` ezali te
kobandisa shene 'hover focus'. ndenge nini tooltip ebandi - finá | kosala hover | focus | mokanda. Note yo cas passe déclencheur mutliple, espace séparé, ba types ya déclencheur.
kozelisa motango | moto ya likambo 0.

retard ya kolakisa pe kobomba tooltip (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 }

eloko oyo batyaka na kati molongo ya molongo | lokuta lokuta

Ebakisi toli ya bisaleli na eloko moko ya sikisikicontainer: 'body'

Mitó likoló! 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.

Kosala bilembo

  1. <a href = "#" data-toggle = "toli ya bisaleli" title = "toli ya esaleli ya yambo" > tombola likolo na ngai </a>

Ba méthodes ya kosala

$().tooltip(ba options) .

Ezali kokangisa mosaleli ya tooltip na liboke ya biloko.

.tooltip('lakisa')

Ezali kobimisa tooltip ya élément moko.

  1. $ ( '#elemento' ). tooltip ( 'lakisa' ) .

.tooltip('bomba') .

Ebombaka toli ya bisaleli ya eleman moko.

  1. $ ( '#elemento' ). tooltip ( 'bomba' ) .

.tooltip('kobongola')

Ezali kobongola toggle ya tooltip ya élément moko.

  1. $ ( '#elemento' ). tooltip ( 'kobongola' ) .

.tooltip('kobebisa') .

Ebombaka mpe ebebisaka tooltip ya élément moko.

  1. $ ( '#elemento' ). tooltip ( 'kobebisa' ) .

Bandakisa

Bakisa ba superpositions ya mike ya contenus, lokola oyo ezali na iPad, na élément nionso pona ko loger ba informations secondaires. Botia loboko likolo ya bouton mpo na ko déclencher popover. Esengaka Tooltip ezala na kati.

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.

Marquage moko te elakisami lokola ba popovers esalemi uta na JavaScript mpe makambo oyo ezali na kati ya dataattribut moko.

Démonstration en direct

Ba direction minei


Kosalela yango

Bofungola ba popovers na nzela ya JavaScript:

  1. $ ( '#ndakisa' ). popover ( ba 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 kosalela transition ya css fade na tooltip
html boolean lokuta Kotisa html na kati ya popover. Soki lokuta, méthode ya jquery textekosalelama pona ko kotisa contenus 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 | malamu
moponi shene lokuta soki moponi epesami, biloko ya tooltip ekopesama na ba cibles oyo elakisami
kobandisa shene 'cliquez'. ndenge nini popover ebandi - finá | kosala hover | focus | mokanda
titre molongo ya molongo | mosala '' . motuya ya titre ya liboso soki attribut `title` ezali te
makambo eza na kati molongo ya molongo | mosala '' . motuya ya makambo ya liboso soki attribut `data-content` ezali te
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 }

eloko oyo batyaka na kati molongo ya molongo | lokuta lokuta

Ebakisi popover na élément moko ya sikisikicontainer: 'body'

Mitó likoló! Ba options pona ba popovers individuels ekoki alternativement précisé na nzela ya usage ya ba attributs ya ba données.

Kosala bilembo

Mpo na bantina ya mosala, Tooltip mpe Popover data-apis ezali opt in. Soki olingi kosalela yango, lakisa kaka option ya moponi.

Ba méthodes ya kosala

$().popover(ba options) .

Initialise ba popovers pona collection ya élément.

.popover('lakisa') .

Emonisaka popover moko ya ba éléments.

  1. $ ( '#elemento' ). popover ( 'elakisaka' ) .

.popover('bomba') .

Ebombaka popover moko ya ba éléments.

  1. $ ( '#elemento' ). popover ( 'bomba' ) .

.popover('kobongola')

Toggles an ba éléments popover.

  1. $ ( '#elemento' ). popover ( 'kobongola' ) .

.popover('kobebisa') .

Ebombaka mpe ebebisaka popover ya élément moko.

  1. $ ( '#elemento' ). popover ( 'kobebisa' ) .

Ndakisa ya makebisi

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

Guacamole mosantu! Meilleur vérifier yo self, ozali komonana trop bien te.

Oh snap! Ozui erreur moko!

Bobongola oyo mpe oyo mpe meká lisusu. Duis mollis, est non commodo luctus, nisi erat ligula ya porte, eget lacinia odio sem nec elit. Cras mattis consectetur purus efandaka na fermentum.

Salá likambo yango To mpe salá boye


Kosalela yango

Bofungola bolongolami ya likebisi na nzela ya JavaScript:

  1. $ ( ".kebisi" ). kokebisa () .

Kosala bilembo

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

  1. <a classe = "kokanga" data-dismiss = "kebisi" href = "#" > &ntango; </a>

Ba méthodes ya kosala

$().alert() .

Enveloppe ba alertes nionso na fonctionnalité ya proche. Pona kozala na ba alertes na yo animation libanda tango ekangami, sala que bazala na classe ya .fadepe .indéjà appliqué na bango.

.alert('kokanga')

Ekangaka alerte moko.

  1. $ ( ".kebisi" ). alerte ( 'kokanga' ) .

Makambo oyo esalemaki

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

Likambo Ndimbola
kokanga Evenement oyo ezo beta mbala moko tango closeméthode ya instance ebengami.
ekangami Evenement oyo ezo beta tango alerte ekangami (ekozela ba transitions ya css esila).
  1. $ ( '#kebisi-na ngai' ). bind ( 'ekangama' , mosala () { .
  2. // sala eloko moko...
  3. }) .

Ndakisa ya kosalela

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.

Kozala na Leta

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

  1. < lolenge ya bouton = "bouton" classe = "btn btn-primary" data-loading-text = "Ezali kokɔtisa..." > Etat ya kokɔtisa </button>

Toggle moko

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

  1. < lolenge ya bouton = "bouton" classe = "btn btn-primaire" data-toggle = "bouton" > Botomboli moko </bouton>

Boîte de vérification

Bakisa data-toggle="buttons-checkbox"mpo na kobongola lolenge ya boîte de coche na btn-group.

  1. <div class = "btn-groupe" ba données-toggle = "boîte de contrôle-ba boutons" >
  2. < lolenge ya bouton = "bouton" classe = "btn btn-primaire" > Na loboko ya mwasi </bouton>
  3. < lolenge ya bouton = "bouton" classe = "btn btn-primaire" > Kati </bouton>
  4. < lolenge ya bouton = "bouton" classe = "btn btn-primaire" > Bouton ya mobali </bouton>
  5. </div>

Radio

Bakisa data-toggle="buttons-radio"mpo na kosala ba toggling ya style ya radio na btn-group.

  1. < kelasi ya div = "btn-groupe" ba données-toggle = "ba boutons-radio" >
  2. < lolenge ya bouton = "bouton". classe = "btn btn-primaire" > Na loboko ya mwasi </bouton>
  3. < lolenge ya bouton = "bouton". classe = "btn btn-primaire" > Kati </bouton>
  4. < lolenge ya bouton = "bouton". classe = "btn btn-primaire" > Bouton ya mobali </bouton>
  5. </div>

Kosalela yango

Bofungola ba boutons na nzela ya JavaScript:

  1. $ ( '.nav-ba-tabs' ). bouton () .

Kosala bilembo

Ba attributs ya ba données ezali intégrale na plugin ya bouton. Tala code ya ndakisa oyo ezali awa na nse mpo na mitindo ndenge na ndenge ya bilembo.

Makambo oyo okoki kopona

Moko te

Ba méthodes ya kosala

$().bouton('kobongola')

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

Mitó likoló! Okoki ko activer auto toggling ya bouton moko na kosalela data-toggleattribut.
  1. < lolenge ya bouton = "bouton" classe = "btn" data-toggle = "bouton" > ... </bouton>

$().button('kozwa')

Ebongisi état ya bouton na chargement - e désactiver bouton mpe e swap texte na chargement ya texte. Esengeli kolimbola makomi na eleman ya bouton na kosalelaka attribut ya ba données data-loading-text.

  1. < lolenge ya bouton = "bouton" classe = "btn" data-loading-text = "kozwa biloko..." > ... </button>
Mitó likoló! Firefox ezo persister état désactivé na kati ya ba charges ya page . Likambo ya kosilisa likambo yango ezali ya kosalela autocomplete="off".

$().button('kozongisa na esika na yango')

Ezongisaka état ya bouton - ebongoli makomi na makomi ya ebandeli.

$().bouton(molongo) .

Réinitialiser état ya bouton - echanger texte na état nionso ya texte oyo e définir na ba données.

  1. < lolenge ya bouton = "bouton" classe = "btn" data-complete-text = "esili!" > ... </bouton>
  2. <script>
  3. $ ( '.btn' ) Ezali ndenge moko. bouton ( 'kosilisa' ) .
  4. </script>

Pene

Bozua ba styles ya base na soutien flexible pona ba composants collapsibles lokola ba accordions na navigation.

* Esengi ete plugin ya Transitions ezala na kati.

Ndakisa ya accordéon

Na kosalelaka plugin ya collapse, totongaki widget ya style ya accordéon ya pete:

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.
  1. <div classe = "accordion" id = "accordion2" >
  2. <div class = "etuluku-ya-accordion" >
  3. <div class = "motó ya likambo ya accordion" >
  4. <a class = "accordion-toggle" data-toggle = "kokwea" moboti-ya-donnée = "#accordion2" href = "#kokweaMoko" >
  5. Eloko ya Lisanga oyo ekoki kokangama #1
  6. </a>
  7. </div>
  8. <div id = "collapseOne" class = "kokwea ya nzoto-accordion na" >
  9. <div class = "accordion-ya kati" >
  10. Anim pariatur cliché ya...
  11. </div>
  12. </div>
  13. </div>
  14. <div class = "etuluku-ya-accordion" >
  15. <div class = "motó ya likambo ya accordion" >
  16. <a class = "accordion-toggle" data-toggle = "kokwea" moboti-ya-donnée = "#accordion2" href = "#kokweaMibale" >
  17. Eloko ya Lisanga oyo ekoki kokangama #2
  18. </a>
  19. </div>
  20. <div id = "kokweaMibale" classe = "kokwea ya nzoto-accordion" >
  21. <div class = "accordion-ya kati" >
  22. Anim pariatur cliché ya...
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. ...

Okoki pe kosalela plugin sans marquage ya accordéon. Sala bouton toggle expansion na collapse ya élément mosusu.

  1. < lolenge ya bouton = "bouton" classe = "btn btn-danger" data-toggle = "kokwea" data-cible = "#demo" >
  2. simple oyo ekoki kokangama
  3. </bouton>
  4.  
  5. <div id = "demo" classe = "kokwea na" > ... </div>

Kosalela yango

Na nzela ya ba attributs ya ba données

Bakisa kaka data-toggle="collapse"na data-targetélément moko na pona ko assigner automatiquement contrôle ya élément collapsible. Attribut data-targetendimi selecteur 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, bakisa kelasi ya kobakisain .

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:

  1. $ ( ".kokwea" ). kokwea () .

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 selecteur alors ba éléments nionso collapsible na se ya parent oyo elakisami ekokangama tango eloko oyo collapsible elakisami. (ekokani na bizaleli ya bonkɔkɔ ya accordéon)
kobongola makambo boolean ya solo Ebalusaka élément collapsible na invocation

Ba méthodes ya kosala

.collapse(ba options) .

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

  1. $ ( '#na ngaiEkoki kokangama' ). kokwea ({
  2. toggle : lokuta
  3. }) .

.collapse('kobongola')

Ezali kobongola eloko oyo ekoki kokangama mpo na kolakisa to kobombama.

.collapse('lakisa') .

Ezali kolakisa eleman moko oyo ekoki kokangama.

.collapse('bomba') .

Ebombaka eloko moko oyo ekoki kokangama.

Makambo oyo esalemaki

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

Likambo Ndimbola
kolakisa Evenement oyo ezo beta mbala moko tango showméthode ya instance ebengami.
oyo emonisami Evenement oyo ezo beta tango élément ya collapse esalemi visible na usager (ekozela ba transitions ya css esila).
kobombana Evenement oyo ebetamaka mbala moko tango hideméthode ebengami.
ya kobombana Evenement oyo ezo beta tango élément ya collapse ebombami na mosaleli (ekozela ba transitions ya css esila).
  1. $ ( '#na ngaiEkoki kokangama' ). na ( 'ebombami' , mosala () {
  2. // sala eloko moko...
  3. }) .

Ndakisa

Plugin ya moboko, oyo ebakisami na pete mpo na kosala nokinoki ba typeaheads ya elegan na bokoti ya makomi ya formulaire nyonso.

  1. < lolenge ya bokoti = "mokomi" data-provide = "typeahead" >

Okolinga kotya autocomplete="off"mpo na kopekisa ba menu ya navigateur ya liboso ebima na likoló ya esika oyo bakomi Bootstrap typeahead.


Kosalela yango

Na nzela ya ba attributs ya ba données

Bakisa ba attributs ya ba données pona ko enregistrer élément na fonctionnalité typeahead ndenge elakisami na exemple oyo ezali likolo.

Na nzela ya JavaScript

Benga typeahead na maboko na:

  1. $ ( '.kokoma liboso' ). kokoma liboso () .

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-source="".

Nkombo lolenge mbeba ndimbola
esika array, mosala [ ] . Source ya ba données ya ko requêter contre. Ekoki kozala ensemble ya ba chaînes to fonction. Fonction elekisaka ba arguments mibale, queryvaleur na champ ya entrée na processcallback. Fonction ekoki kosalelama na ndenge ya synchrone na kozongisaka source ya ba données directement to na ndenge ya asynchrone na nzela processya argument moko ya callback.
biloko nimero 8 Max nombre ya biloko oyo esengeli kolakisa na dropdown.
minBolai ya nzoto nimero 1. 1. Bolai ya bilembo ya moke oyo esengeli liboso ya ko déclencher makanisi ya autocomplète
mosali ya boyokani mosala insensible na ba lettres minene Méthode oyo basalelaka pona koyeba soki query moko ekokani na eloko moko. Andimi argument moko, oyo itemcontre oyo esengeli komeka query. Kokota na motuna ya lelo na this.query. Zongisa boolean truesoki requête ezali match.
mobongisi-nzela mosala boyokani ya sikisiki,
oyo ezali na ba lettres minene te,
oyo ezali na ba lettres minene te
Méthode oyo basalelaka pona ko trier ba résultats autocomplètes. Andimi argument moko itemsmpe ezali na portée ya instance ya typeahead. Bosala référence na motuna ya lelo na this.query.
mobongisi-nzela mosala ezongisaka eloko oyo oponi Méthode oyo basalelaka mpo na kozongisa eloko oyo oponi. Andimi argument moko, na itemmpe ezali na portée ya instance ya typeahead.
eloko oyo emonisaka makambo mingi mosala ezo lakisa ba matchs nionso ya défaut Méthode oyo basalelaka pona ko souligner ba résultats autocomplètes. Andimi argument moko itemmpe ezali na portée ya instance ya typeahead. Esengeli kozongisa html.

Ba méthodes ya kosala

.typeahead(ba options) .

Ebandisaka entrée na typeahead.

Ndakisa

Sous-navigation oyo ezali na gauche ezali démonstration en direct ya plugin ya affix.


Kosalela yango

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. Na nsima, salelá ba offsets mpo na kolimbola ntango nini osengeli kofungola mpe kokanga pinning ya élément moko.

  1. <div data-spy = "affixer" ba données-offset-likolo = "200" > ... </div>
Mitó likoló! Esengeli o gérer position ya élément pinné na comportement ya parent na yango ya proche. Position ezali contrôlée na affix, affix-top, na affix-bottom. Kobosana te kotala soki moboti oyo akoki kokwea ntango affixe ekota lokola ezali kolongola makambo na flux normal ya lokasa.

Na nzela ya JavaScript

Benga plugin ya affix na nzela ya JavaScript:

  1. $ ( '#navbar' ). affix 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-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 nimero moko epesami, offset ekosalema na ngámbo ya likoló mpe ya lobɔkɔ ya mwasi. Mpo na koyoka nzela moko, to ba offsets ebele oyo ekeseni na mosusu, pesa kaka eloko moko offset: { x: 10 }. Salelá fonction ntango osengeli kopesa na ndenge ya dynamique offset (ezali na ntina mpo na mwa badesign oyo ekoki koyanola).