Javascript

Aumai vaega a Bootstrap i le ola-lea ua i ai nei 13 faʻapipiʻi masani jQuery.

Ulu i luga! O nei pepa e mo le v2.3.2, lea e le o toe lagolagoina aloaia. Siaki le lomiga lata mai o Bootstrap!

Ta'ito'atasi pe tuufaatasia

E mafai ona fa'aofi fa'apipi'i ta'ito'atasi (e ui o nisi e mana'omia fa'alagolago), po'o fa'atasi uma. O le bootstrap.js ma le bootstrap.min.js o loʻo iai uma faʻapipiʻi i se faila e tasi.

Uiga fa'amaumauga

E mafai ona e fa'aogaina uma Bootstrap plugins mama e ala i le fa'ailoga API e aunoa ma le tusiaina o se laina se tasi o le JavaScript. O le API vasega muamua lea a Bootstrap ma e tatau ona avea ma au iloiloga muamua pe a faʻaaogaina se masini.

Na faapea mai, i nisi tulaga atonu e manaʻomia e tape lenei galuega. O le mea lea, matou te tu'uina atu fo'i le agava'a e fa'amalo ai le fa'amatalaga uiga API e ala i le tatalaina o mea uma na tutupu i luga o le igoa o le tino fa'atasi ma le `'data-api'`. E pei o lenei:

  1. $ ( 'tino' ). tape ( '.data-api' )

I le isi itu, e faʻatatau i se mea faʻapipiʻi faʻapitoa, naʻo le faʻapipiʻiina o le igoa ole plugin o se igoa avanoa faʻatasi ai ma le data-api namespace pei o lenei:

  1. $ ( 'tino' ). pe ( '.alert.data-api' )

API polokalame

Matou te talitonu foi e tatau ona e faʻaogaina uma Bootstrap plugins mama e ala i le JavaScript API. O API fa'alaua'itele uma e tasi, auala e mafai ona filifili, ma toe fa'afo'i le aoina na fa'atino.

  1. $ ( ".btn.danger" ). faamau ( "toggle" ). addClass ( "ga'o" )

O metotia uma e tatau ona talia se mea e filifili ai filifiliga, se manoa e faʻatatau i se metotia faʻapitoa, poʻo leai se mea (lea e amataina ai se faʻapipiʻi ma amioga le lelei):

  1. $ ( "#myModal" ). modal () // amataina i faaletonu
  2. $ ( "#myModal" ). modal ({ keyboard : false }) // amataina e aunoa ma se piano
  3. $ ( "#myModal" ). modal ( 'fa'aali' ) // amataina ma vala'au fa'aalia vave

E fa'aalia fo'i e fa'apipi'i ta'itasi lona faufale mata'utia i luga o se meatotino `Fausia': $.fn.popover.Constructor. Afai e te manaʻo e maua se faʻataʻitaʻiga faʻapitoa faʻapipiʻi, aumai saʻo mai se elemene: $('[rel=popover]').data('popover').

Leai se Fete'ena'i

O nisi taimi e manaʻomia le faʻaogaina o Bootstrap plugins ma isi faʻavae UI. I ia tulaga, e mafai ona tupu i nisi taimi le fete'ena'iga o igoa. Afai e tupu lenei mea, e mafai ona e valaʻau .noConflicti le plugin e te manaʻo e toe faʻafoʻi le tau o.

  1. var bootstrapButton = $ . fn . faamau . noConflict () // toe faafoi le $.fn.button i le tau na tofia muamua
  2. $ . fn . bootstrapBtn = bootstrapButton // tu'u $().bootstrapBtn le fa'atinoina o galuega

Mea na tutupu

O le Bootstrap e maua ai mea faʻapitoa mo le tele o gaioiga faʻapitoa a le plugin. E masani lava, o nei mea e sau i se fa'ailoga fa'apitoa ma fa'asologa ua mavae - lea e fa'aosoina ai le infinitive (ex. show) i le amataga o se mea na tupu, ma lona fa'ailoga participle ua mavae (ex. shown) e fa'aosoina pe a mae'a se gaioiga.

O mea uma e le fa'ai'u e maua ai le fa'atinoga o le preventDefault. O lenei mea e maua ai le malosi e taofi ai le faʻatinoina o se gaioiga aʻo leʻi amataina.

  1. $ ( '#myModal' ). i luga ( 'fa'aali' , galuega ( e ) {
  2. afai (! data ) toe fo'i u . preventDefault () // taofi le modal mai le faʻaalia
  3. })

E uiga i suiga

Mo a'afiaga faigofie o suiga, fa'aofi bootstrap-transition.js fa'atasi ma isi faila JS. Afai o loʻo e faʻaaogaina le bootstrap.js tuʻufaʻatasia , e leai se manaʻoga e aofia ai lenei mea-ua uma ona iai.

Fa'aoga mataupu

O nai faʻataʻitaʻiga o le suiga faʻapipiʻi:

  • Fa'ase'e po'o le mou atu i auala
  • Ua mou atu fa'amau
  • Fa'aliga fa'alilolilo
  • Fa'ase'e ta'avale carousel

Faataitaiga

O auala e fa'afaigofie, ae fetu'una'i, fa'asalalauga fa'atasi ma le fa'aitiitiga mana'omia ma fa'aletonu atamai.

Fa'ata'ita'iga tumau

Se fa'atusa fa'atusa fa'atasi ai ma ulutala, tino, ma se seti o gaioiga i le vae.

  1. <div class = "modal hide fade" >
  2. <div class = "modal-header" >
  3. <button type = "button" class = "close" data-dismiss = "modal" aria-natia = "moni" > &taimi; </fa'amau>
  4. <h3> Ulutala fa'atatau </h3>
  5. </div>
  6. <div class = "modal-body" >
  7. <p> Tasi le tino lelei... </p>
  8. </div>
  9. <div class = "modal-footer" >
  10. <a href = "#" class = "btn" > Tapuni </a>
  11. <a href = "#" class = "btn btn-primary" > Sefe suiga </a>
  12. </div>
  13. </div>

Live demo

Su'e se fa'aoga e ala ile JavaScript ile kilikiina ole ki lalo. O le a fa'ase'e ifo i lalo ma mou atu mai le pito i luga o le itulau.

  1. <!-- Fa'amau e fa'aoso ai le fa'asologa -->
  2. <a href = "#myModal" role = "button" class = "btn" data-toggle = "modal" > Tatala fa'ata'ita'iga auala </a>
  3.  
  4. <!-- Modal -->
  5. <div id = "myModal" vasega = "fade natia tupe" tabindex = "-1" role = "dialog" aria-labelledby = "myModalLabel" aria-natia = "moni" >
  6. <div class = "modal-header" >
  7. <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "moni" > × </button>
  8. <h3 id = "myModalLabel" > Ulutala fa'atatau </h3>
  9. </div>
  10. <div class = "modal-body" >
  11. <p> Tasi le tino lelei... </p>
  12. </div>
  13. <div class = "modal-footer" >
  14. <button class = "btn" data-dismiss = "modal" aria-hidden = "true" > Tapuni </ button>
  15. <button class = "btn btn-primary" > Fa'asao suiga </button>
  16. </div>
  17. </div>

Fa'aoga

E ala i fa'amaumauga uiga

Fa'agaoioia se faiga e aunoa ma le tusia o le JavaScript. Seti data-toggle="modal"i luga o se elemene e pulea, pei o se faamau, faatasi ai ma se data-target="#foo"po href="#foo"o le taulaʻi i se faiga faʻapitoa e fesuiaʻi.

  1. <button type = "button" data-toggle = "modal" data-target = "#myModal" > Fa'alauiloa auala </button>

E ala i le JavaScript

Valaau se modal ma id myModalma se laina e tasi o le JavaScript:

  1. $ ( '#myModal' ). modal ( filifiliga )

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-, pei o le data-backdrop="".

Igoa ituaiga faaletonu fa'amatalaga
tuaa boolean moni E aofia ai se elemene fa'aola-backdrop. I le isi itu, fa'amaoti staticmo se fa'ata'atia e le tapuni ai le auala ile kiliki.
piano boolean moni Tapuni le auala pe a oomi le ki sola
fa'aali boolean moni Fa'aalia le faiga pe'ā amata.
mamao ala pepelo

Afai e tuʻuina atu se url mamao, o le a utaina mea e ala i le loadauala a le jQuery ma tui i totonu o le .modal-body. Afai o lo'o e fa'aogaina le data api, e mafai ona e fa'aogaina le hrefpine e fa'ailoa ai le puna mamao. O se faʻataʻitaʻiga o lenei mea o loʻo faʻaalia i lalo:

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

Metotia

.modal(filifiliga)

Fa'agaoioia lau anotusi e fai ma fa'ata'ita'iga. Talia se filifiliga faitalia object.

  1. $ ( '#myModal' ). auala ({
  2. piano : sese
  3. })

.modal('toggle')

Su'e ma le lima se faiga.

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

.modal('fa'aali')

Tatala ma le lima se auala.

  1. $ ( '#myModal' ). modal ( 'fa'aali' )

.modal('natia')

Natia ma le lima se auala.

  1. $ ( '#myModal' ). modal ( 'natia' )

Mea na tutupu

O le vasega fa'apitoa a Bootstrap o lo'o fa'aalia ai ni nai mea na tutupu mo le fa'aogaina o galuega fa'atino.

Mea na tupu Fa'amatalaga
fa'aali E mu vave lenei mea pe a showvalaʻau le auala faʻataʻitaʻiga.
faaalia O lenei mea na tupu e faʻamalo pe a faʻaalia le modal i le tagata faʻaoga (o le a faʻatali mo suiga css e maeʻa).
lalafi O lenei mea na tupu e faʻamalo vave pe a hidevalaʻau le auala faʻataʻitaʻiga.
natia O lenei mea e tupu pe a maeʻa ona natia le modal mai le tagata faʻaoga (o le a faʻatali mo suiga css e maeʻa).
  1. $ ( '#myModal' ). i luga ( 'natia' , galuega () {
  2. // fai se mea...
  3. })

Faataitaiga i le navbar

O le ScrollSpy plugin e mo le fa'afouina otometi fa'atatau i luga ole laiga e fa'atatau ile tulaga ta'ai. Fa'asolo le vaega i lalo o le navbar ma matamata le suiga o le vasega. O le a fa'amaninoina fo'i le fa'ailoga pito i lalo.

@ga'o

Ad leggings keytar, brunch id art party dolor laboure. Pitchfork yr enim lo-fi ae le'i fa'atau atu. Tumblr farm-to-table uila aia tatau po o le a lava. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui masalo e te le'i faalogo iai ma cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

@mdo

Veniam marfa mustache laupapa, adipisicing fugiat velit pitchfork 'ava. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat fa loko nisi, ea helvetica nulla carles. Ta'u mea'ai ta'avale cosby pe'a, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.

tasi

Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo uila aia tatau adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. O le Vero VHS o le faʻaleleia. Consectetur nisi DIY minim avefe'au ato. Cred ex in, sustainable delectus consectetur fanny pack iphone.

lua

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 avefe'au ato marfa so'o se loli meaai. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats masalo e te le'i faalogo ia i latou consequat hoodie gluten-free lo-fi fap aliquip. Laboure elit placeat ae le'i fa'atau atu, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.


Fa'aoga

E ala i fa'amaumauga uiga

Ina ia fa'afaigofie ona fa'aopoopo le amio ta'avale i lau ta'avale pito i luga, na'o le fa'aopoopo data-spy="scroll"i le elemene e te mana'o e sipai ai (sili ona masani o le tino lea) ma data-target=".navbar"filifili po'o fea nav e fa'aoga. E te mana'o e fa'aoga scrollspy ma se .navvaega.

  1. <body data-spy = "scroll" data-target = ".navbar" > ... </body>

E ala i le JavaScript

Valaau le scrollspy e ala i le JavaScript:

  1. $ ( '#navbar' ). scrollspy ()
Ulu i luga! O feso'ota'iga Navbar e tatau ona i ai ni fa'ailoga id e mafai ona fo'ia. Mo se faʻataʻitaʻiga, e <a href="#home">home</a>tatau ona fetaui ma se mea i totonu o le fale e pei o <div id="home"></div>.

Metotia

.scrollspy('refresh')

A faʻaaoga le scrollspy faʻatasi ma le faʻaopoopoina poʻo le aveesea o elemene mai le DOM, e tatau ona e valaʻau le auala faʻafouina e pei o lea:

  1. $ ( '[data-spy="scroll"]' ). taitasi ( galuega ( ) {
  2. var $spy = $ ( lenei ). scrollspy ( 'refresh' )
  3. });

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-, pei o le data-offset="".

Igoa ituaiga faaletonu fa'amatalaga
fa'apena numera 10 Pixels e fa'asolo mai luga pe a fa'atatau le tulaga o le ta'ai.

Mea na tutupu

Mea na tupu Fa'amatalaga
fa'agaoioi E mu lenei mea i so'o se taimi e fa'agaoioi ai se mea fou e le scrollspy.

Fa'ata'ita'iga tabs

Fa'aopoopo le fa'agaioiga fa'agaoioiga fa'avavevave ma fa'amalosi i le fa'aliliuina i fa'amalama o mea fa'apitonu'u, e o'o lava ile fa'aulu i lalo menus.

Raw denim masalo e te le'i fa'alogo i ai Jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Faʻafeiloaʻi i le salvia cillum iphone. Seitan aliquip quis cardigan ofu Amerika, butcher voluptate nisi qui.

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


Fa'aoga

Fa'aaga tabbable tabs e ala i le JavaScript (ta'itasi ta'itasi e mana'omia ona fa'agaoioia ta'ito'atasi):

  1. $ ( '#myTab a' ). kiliki ( galuega ( e ) {
  2. e . preventDefault ();
  3. $ ( lenei ). tab ( 'fa'aali' );
  4. })

E mafai ona e fa'agaoioia ta'iala ta'itasi i le tele o auala:

  1. $ ( '#myTab a[href="#profile"]' ). tab ( 'fa'aali' ); // Filifili le lisi ile igoa
  2. $ ( '#myTab a:muamua' ). tab ( 'fa'aali' ); // Filifili le laupepa muamua
  3. $ ( '#myTab a:muli' ). tab ( 'fa'aali' ); // Filifili le laupepa mulimuli
  4. $ ( '#myTab li:eq(2) a' ). tab ( 'fa'aali' ); // Filifili le laupepa lona tolu (0-indexed)

Fa'ailoga

E mafai ona e fa'agaoioia se fa'ailoga po'o se pill navigation e aunoa ma le tusiaina o so'o se JavaScript i le na'o le fa'ama'oti data-toggle="tab"po'o data-toggle="pill"luga o se elemene. O le fa'aopoopoina o le navma nav-tabsvasega i le fa'ailoga o le ula fa'aogaina ai le fa'ailoga o le Bootstrap tab.

  1. <ul class = "nav nav-tabs" >
  2. <li><a href = "#home" data-toggle = "tab" > Fale </a></li>
  3. <li><a href = "#profile" data-toggle = "tab" > Tala'aga </a></li>
  4. <li><a href = "#messages" data-toggle = "tab" > Feau </a></li>
  5. <li><a href = "#settings" data-toggle = "tab" > Seti </a></li>
  6. </ul>

Metotia

$().tab

Fa'aagaoioia se fa'ailoga elemene ma mea o lo'o i totonu. O le Tab e tatau ona i ai se data-targetpoʻo se hreffaʻatatau i se pusa pusa i le DOM.

  1. <ul class = "nav nav-tabs" id = "myTab" >
  2. <li class = "active" ><a href = "#home" > Home </a></li>
  3. <li><a href = "#profile" > Tala'aga </a></li>
  4. <li><a href = "#messages" > Savali </a></li>
  5. <li><a href = "#settings" > Fa'atonu </a></li>
  6. </ul>
  7.  
  8. <div class = "tab-content" >
  9. <div class = "tab-pane active" id = "home" > ... </div>
  10. <div class = "tab-pane" id = "profile" > ... </div>
  11. <div class = "tab-pane" id = "messages" > ... </div>
  12. <div class = "tab-pane" id = "settings" > ... </div>
  13. </div>
  14.  
  15. <script>
  16. $ ( galuega () {
  17. $ ( '#myTab a:muli' ). tab ( 'fa'aali' );
  18. })
  19. </script>

Mea na tutupu

Mea na tupu Fa'amatalaga
fa'aali O lenei mea na tupu e mu i luga o faʻaaliga faʻaaliga, ae leʻi faʻaalia le faʻailoga fou. Fa'aoga event.targetma event.relatedTargetfa'atatau i le ta'i ga'oi ma le fa'agaioiga muamua (pe a maua) ta'itasi.
faaalia O lenei mea na tupu e mu i luga o le faʻaaliga faʻapipiʻi pe a uma ona faʻaalia se tab. Fa'aoga event.targetma event.relatedTargetfa'atatau i le ta'i ga'oi ma le fa'agaioiga muamua (pe a maua) ta'itasi.
  1. $ ( 'a[data-toggle="tab"]' ). i luga ( 'fa'aalia' , galuega ( e ) {
  2. e . sini // fa'agaoioia tab
  3. e . relatedTarget // tab muamua
  4. })

Faataitaiga

Musuia e le sili jQuery.tipsy plugin tusia e Jason Frame; Tooltips o se fa'afouga fou, e le fa'alagolago i ata, fa'aoga le CSS3 mo fa'afiafiaga, ma fa'amaumauga-uiga mo le teuina o suafa fa'apitonu'u.

Mo mafua'aga o fa'atinoga, o le tooltip ma le popover data-apis o lo'o filifili i totonu, o lona uiga e tatau ona e amataina oe lava ia .

Fa'apa i luga o so'oga o lo'o i lalo e va'ai i mea faigaluega:

ofuvae fufusi isi tulaga keffiyeh masalo e te le'i fa'alogo iai. Fa'ato'aga ata 'ava fa'a denim mata'itusi vegan taga avefe'au stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit amerika ofu e iai le terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, fa loko mcsweeney's cleanse vegan chambray. O se tufuga fa'atauva'a lava so'o se keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.

Fa ituala

Tooltips i vaega fa'aoga

A fa'aoga meafaigaluega ma popovers fa'atasi ai ma vaega fa'aoga a Bootstrap, e tatau ona e setiina le container(fa'amauina i lalo) filifiliga e aloese ai mai a'afiaga e le mana'omia.


Fa'aoga

Fa'aoso le mea faigaluega e ala ile JavaScript:

  1. $ ( '#fa'ata'ita'iga' ). mea faigaluega ( filifiliga )

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-, pei o le data-animation="".

Igoa ituaiga faaletonu fa'amatalaga
animation boolean moni fa'aoga se suiga e mou atu css i le mea faigaluega
html boolean pepelo Fa'aofi le html i totonu o le meafaigaluega. Afai e sese, o le a faʻaaogaina le textmetotia a le jquery e faʻaofi ai mea i totonu o le dom. Fa'aoga tusitusiga pe a e popole i osofa'iga a le XSS.
tu'uga manoa | galuega faatino 'pito' fa'afefea ona fa'atulaga le mea faigaluega - pito i luga | lalo | agavale | tauagavale
tagata filifilia manoa pepelo Afai e tu'uina atu se tagata filifilia, o mea fa'aoga meafaigaluega o le a tu'uina atu i sini fa'apitoa.
suafa manoa | galuega faatino '' fa'aigoa fa'aigoa pe afai e le o iai le pine o le 'igoa'
fa'aoso manoa 'ave le taulai' pe fa'afefea ona fa'aosoina meafaigaluega - kiliki | lele | taula'i | tusi lesona. Fa'ailoa lau mataupu pasi fa'aoso mutliple, vaeluaga avanoa, fa'aoso ituaiga.
tuai numera | mea faitino 0

fa'atuai ona fa'aali ma nana le mea faigaluega (ms) - e le fa'atatau ile ituaiga fa'aoso tusi

Afai e tu'uina atu se numera, fa'atuai e fa'aoga i natia/fa'aali uma

O le fausaga o mea faitino o le:delay: { show: 500, hide: 100 }

pusa manoa | pepelo pepelo

Fa'apipi'i le mea faigaluega i se elemene fa'apitoacontainer: 'body'

Ulu i luga! O filifiliga mo meafaigaluega ta'ito'atasi e mafai ona fa'avasegaina e ala i le fa'aogaina o uiga fa'amaumauga.

Fa'ailoga

  1. <a href = "#" data-toggle = "tooltip" title = "first tooltip" > fa'ae'e i luga o a'u </a>

Metotia

$(). tooltip(filifiliga)

Fa'apipi'i se tu'u fa'amatalaga meafaigaluega i se aoina elemene.

.tooltip('fa'aali')

Fa'aalia le mea faigaluega o se elemene.

  1. $ ( '#elemene' ). meafaigaluega ( 'fa'aali' )

.tooltip('natia')

Natia le mea faigaluega o se elemene.

  1. $ ( '#elemene' ). meafaigaluega ( 'natia' )

.tooltip('toggle')

Su'e le pito meafaigaluega a se elemene.

  1. $ ( '#elemene' ). mea faigaluega ( ' toggle ' )

.tooltip('fa'aumatia')

Natia ma fa'aleagaina le fa'aoga meafaigaluega.

  1. $ ( '#elemene' ). meafaigaluega ( 'fa'aumatia' )

Faataitaiga

Fa'aopoopo ni fa'aputuga laiti o mea, pei o i luga ole iPad, i so'o se elemene mo fa'amatalaga lona lua o fale. Fa'ae'e i luga o le ki e fa'aoso ai le popover. Mana'omia Tooltip e fa'aaofia.

Fa'ato'a fa'apipi'i

E fa filifiliga o lo'o avanoa: luga, taumatau, pito i lalo, ma agavale fa'aoga.

Popover pito i luga

Sed posuere consectetur est at lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Popover sa'o

Sed posuere consectetur est at lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Popover pito i lalo

Sed posuere consectetur est at lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Popover alu ese

Sed posuere consectetur est at lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.

Leai se fa'ailoga fa'aalia o popovers e fa'atupu mai le Javascript ma mea o lo'o i totonu o se datauiga.

Live demo

Fa ituala


Fa'aoga

Fa'amalo popovers e ala i le JavaScript:

  1. $ ( '#fa'ata'ita'iga' ). popover ( filifiliga )

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-, pei o le data-animation="".

Igoa ituaiga faaletonu fa'amatalaga
animation boolean moni fa'aoga se suiga e mou atu css i le mea faigaluega
html boolean pepelo Fa'aofi le html i totonu o le popover. Afai e sese, o le a faʻaaogaina le textmetotia a le jquery e faʻaofi ai mea i totonu o le dom. Fa'aoga tusitusiga pe a e popole i osofa'iga a le XSS.
tu'uga manoa | galuega faatino 'tauagavale' fa'afefea ona fa'atulaga le popover - luga | lalo | agavale | tauagavale
tagata filifilia manoa pepelo afai e tu'uina atu se tagata filifilia, o meafaigāluega o le a tu'uina atu i fa'amoemoega fa'apitoa
fa'aoso manoa 'kiliki' pe fa'afefea ona fa'aoso popover - kiliki | lele | taula'i | tusi lesona
suafa manoa | galuega faatino '' fa'aigoa fa'aigoa pe a le o iai le uiga 'igoa'
anotusi manoa | galuega faatino '' le aoga o mea i totonu pe afai e le o iai le uiga o le 'data-content'
tuai numera | mea faitino 0

fa'atuai ona fa'aali ma nana le popover (ms) - e le fa'atatau ile fa'ailoga tusi tusi

Afai e tu'uina atu se numera, fa'atuai e fa'aoga i natia/fa'aali uma

O le fausaga o mea faitino o le:delay: { show: 500, hide: 100 }

pusa manoa | pepelo pepelo

Fa'aopoopo le popover i se elemene patinocontainer: 'body'

Ulu i luga! O filifiliga mo popovers ta'ito'atasi e mafai ona fa'amaonia e ala i le fa'aogaina o uiga fa'amaumauga.

Fa'ailoga

Mo mafua'aga o fa'atinoga, o le Tooltip ma le Popover data-apis e tu'u i totonu. Afai e te mana'o e fa'aoga ia na'o le fa'atonuina o se filifiliga filifiliga.

Metotia

$().popover(filifiliga)

E amata popovers mo se aoina elemene.

.popover('fa'aali')

Fa'aalia se fa'apipi'i elemene.

  1. $ ( '#elemene' ). popover ( 'fa'aali' )

.popover('natia')

Natia se fa'apipi'i elemene.

  1. $ ( '#elemene' ). popover ( 'natia' )

.popover('toggle')

Fa'asolo i luga o se elemene fa'apipi'i.

  1. $ ( '#elemene' ). popover ( 'toggle' )

.popover('fa'aumatia')

Natia ma fa'aumatia le popover o se elemene.

  1. $ ( '#elemene' ). popover ( 'fa'aumatia' )

Faataitaiga mataala

Fa'aopoopo galuega fa'ate'a i fe'au mataala uma i lenei fa'apipi'i.

Guacamole paia! E sili le siaki ia oe lava, e te le o lelei tele.

Oi vave! Ua e sese!

Suia lea mea ma lena ma toe taumafai. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

Fai lenei gaioiga Pe fai le mea lea


Fa'aoga

Fa'aaga le fa'ate'aina o se mataala e ala i le JavaScript:

  1. $ ( ".alert" ). mataala ()

Fa'ailoga

Na'o le fa'aopoopo data-dismiss="alert"i lau ki tapuni e otometi ai ona tu'uina atu se fa'agaioiga vavalalata mataalia.

  1. <a vasega = "close" data-dismiss = "alert" href = "#" > &taimi; </a>

Metotia

$().alert()

Ta'i fa'alilolilo uma fa'atasi ma fa'atinoga vavalalata. Ina ia fa'aoso au fa'ailo pe a tapuni, ia mautinoa o lo'o i ai le .fadema .inle vasega ua uma ona fa'aoga ia i latou.

.alert('tapuni')

Tapuni se mataala.

  1. $ ( ".alert" ). mataala ( 'tapuni' )

Mea na tutupu

O le vasega mataala a Bootstrap o lo'o fa'aalia ni nai mea na tutupu mo le fa'aogaina i galuega mataala.

Mea na tupu Fa'amatalaga
tapunia E mu vave lenei mea pe a closevalaʻau le auala faʻataʻitaʻiga.
tapuni O lenei mea e tupu pe a tapunia le mataala (o le a faʻatali mo suiga css e maeʻa).
  1. $ ( '#my-alert' ). fusifusia ( 'tapuni' , galuega () {
  2. // fai se mea...
  3. })

Fa'ata'ita'iga fa'aoga

Fai atili i fa'amau. Fa'amalo fa'aigoa po'o le faia o vaega o fa'amau mo nisi vaega e pei o meafaigaluega.

Fa'atutonu

Fa'aopoopo data-loading-text="Loading..."e fa'aoga se tulaga o le utaina i luga o se ki.

  1. <button type = "button" class = "btn btn-primary" data-loading-text = "Loading..." > Tulaga uta </button>

Kilo tasi

Fa'aopoopo data-toggle="button"e fa'agaoioi ai le sosolo i luga o le ki se tasi.

  1. <button type = "button" class = "btn btn-primary" data-toggle = "button" > Toggle Single </button>

Pusa siaki

Fa'aopoopo data-toggle="buttons-checkbox"mo le sitaili o le pusa siaki e sui i luga o le btn-group.

  1. <div class = "btn-group" data-toggle = "buttons-checkbox" >
  2. <button type = "button" class = "btn btn-primary" > Agavale </ button>
  3. <button type = "button" class = "btn btn-primary" > Middle </ button>
  4. <button type = "button" class = "btn btn-primary" > Taumatau </ button>
  5. </div>

Leitio

Fa'aopoopo data-toggle="buttons-radio"mo le sitaili o le leitio e sogi i luga o le btn-group.

  1. <div class = "btn-group" data-toggle = "buttons-radio" >
  2. <button type = "button" class = "btn btn-primary" > Agavale </ button>
  3. <button type = "button" class = "btn btn-primary" > Middle </ button>
  4. <button type = "button" class = "btn btn-primary" > Taumatau </ button>
  5. </div>

Fa'aoga

Fa'aaga fa'amau e ala i le JavaScript:

  1. $ ( '.nav-tabs' ). faamau ()

Fa'ailoga

O uiga fa'amaumauga e tu'ufa'atasia i le fa'amau fa'amau. Siaki le faʻataʻitaʻiga code i lalo mo ituaiga faʻailoga eseese.

Filifiliga

Leai

Metotia

$().button('toggle')

Togi le tulaga tulei. Tu'u atu i le ki le foliga mai ua fa'agaoioia.

Ulu i luga! E mafai ona e fa'aogaina le so'oga fa'amau o se ki i le fa'aogaina o le data-toggleuiga.
  1. <button type = "button" class = "btn" data-toggle = "button" > </button>

$().button('loading')

Seti le tulaga fa'amau i le uta - fa'amalo le fa'amau ma fesuiai tusitusiga i le utaina o tusitusiga. O le utaina o tusitusiga e tatau ona faʻamalamalamaina i luga o le ki elemene e faʻaaoga ai le uiga faʻamatalaga data-loading-text.

  1. <button type = "fa'amau" vasega = "btn" data-loading-text = "loading mea..." > ... </button>
Ulu i luga! O lo'o fa'aauau pea e Firefox le tulaga fa'aletonu i luga o uta itulau . O se fofo mo lenei mea o le faʻaaogaina autocomplete="off".

$().button('reset')

Toe setiina le tulaga fa'amau - fesuia'i tusitusiga i tusitusiga muamua.

$().button( manoa)

Toe setiina le tulaga fa'amau - fa'afesuia'i tusitusiga i so'o se fa'amatalaga fa'amatalaina tulaga o tusitusiga.

  1. <button type = "button" class = "btn" data-complete-text = "uma!" > ... </fa'amau>
  2. <script>
  3. $ ( '.btn' ). faamau ( 'maea' )
  4. </script>

E uiga i

Maua sitaili faavae ma lagolago fetuutuunai mo vaega malepelepe pei o akordion ma le folauga.

* Manaomia le faʻapipiʻi Transitions e aofia ai.

Fa'ata'ita'iga accordion

I le faʻaaogaina o le paʻu faʻapipiʻi, na matou fausia ai se widget style accordion faigofie:

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 luko masina officia aute, e le o se ipu laupapa sikatusi mo brunch. loli meaai quinoa nesciunt laborum eiusmod. Brunch 3 luko moon tempor, sunt aliqua tu'u se manulele i luga o le kofe tasi le amataga 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 masalo e te le'i fa'alogo iai accusamus laboure sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 luko masina officia aute, e le o se ipu laupapa sikatusi mo brunch. loli meaai quinoa nesciunt laborum eiusmod. Brunch 3 luko moon tempor, sunt aliqua tu'u se manulele i luga o le kofe tasi le amataga 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 masalo e te le'i fa'alogo iai accusamus laboure sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 luko masina officia aute, e le o se ipu laupapa sikatusi mo brunch. loli meaai quinoa nesciunt laborum eiusmod. Brunch 3 luko moon tempor, sunt aliqua tu'u se manulele i luga o le kofe tasi le amataga 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 masalo e te le'i fa'alogo iai accusamus laboure sustainable VHS.
  1. <div class = "accordion" id = "accordion2" >
  2. <div class = "accordion-group" >
  3. <div class = "accordion-heading" >
  4. <a class = "accordion-toggle" data-toggle = "pa'ū" data-matua = "#accordion2" href = "#collapseOne" >
  5. Vaega #1
  6. </a>
  7. </div>
  8. <div id = "collapseOne" vasega = "accordion-body pa'ū i totonu" >
  9. <div class = "accordion-inner" >
  10. Anim pariatur cliche...
  11. </div>
  12. </div>
  13. </div>
  14. <div class = "accordion-group" >
  15. <div class = "accordion-heading" >
  16. <a vasega = "accordion-toggle" data-toggle = "pa'ū" data-matua = "#accordion2" href = "#collapseTwo" >
  17. Vaega #2
  18. </a>
  19. </div>
  20. <div id = "collapseTwo" class = "accordion-body collapse" >
  21. <div class = "accordion-inner" >
  22. Anim pariatur cliche...
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. ...

E mafai foi ona e faʻaogaina le faʻapipiʻi e aunoa ma le faʻailoga accordion. Fai se faamau e sui ai le faalautele ma le pa'u o se isi elemene.

  1. <button type = "button" class = "btn btn-danger" data-toggle = "pa'ū" data-target = "#demo" >
  2. faigofie ona malepe
  3. </fa'amau>
  4.  
  5. <div id = "demo" class = "pa'ū i totonu" > </div>

Fa'aoga

E ala i fa'amaumauga uiga

Na'o le fa'aopoopo data-toggle="collapse"ma le data-targeti le elemene e otometi ai ona tu'uina atu le fa'atonuga o se mea e mafai ona fa'apa'ia. E data-targettalia e le uiga le css filifili e fa'aoga le pa'u i. Ia mautinoa e faaopoopo le vasega collapsei le elemene e mafai ona pa'u. Afai e te mana'o e le mafai ona tatala, fa'aopoopo le vasega fa'aopoopoin .

Ina ia fa'aopoopo le pulega vaega e pei o le accordion i se pule e mafai ona pa'u, fa'aopoopo le uiga fa'amaumauga data-parent="#selector". Va'ai i le demo e va'ai ai i lenei gaioiga.

E ala i le JavaScript

Fa'aaga ma le lima ile:

  1. $ ( ".collapse" ). pa'u ()

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-, pei o le data-parent="".

Igoa ituaiga faaletonu fa'amatalaga
matua tagata filifilia pepelo Afai o le tagata filifilia, o le a tapunia uma elemene e mafai ona pa'u i lalo o le matua fa'amaonia pe a fa'aalia le mea e mafai ona fa'asolo. (e taitutusa ma amioga fa'aa'oa'oga masani)
fesuia'i boolean moni Fa'asolo le elemene e mafai ona pa'u i luga ole valaau

Metotia

.collapse(filifiliga)

Fa'aagaoioia lau anotusi o se elemene e mafai ona pa'u. Talia se filifiliga faitalia object.

  1. $ ( '#myCollapsible' ). pa'u ({
  2. toggle : sese
  3. })

.collapse('toggle')

Su'e se elemene e mafai ona pa'u e fa'aali pe natia.

.collapse('fa'aali')

Fa'aalia se elemene e mafai ona pa'u.

.collapse('natia')

Natia se elemene e mafai ona pa'u.

Mea na tutupu

O le vasega pa'u a Bootstrap o lo'o fa'aalia ni nai mea na tutupu mo le fa'aogaina o galuega fa'aletonu.

Mea na tupu Fa'amatalaga
fa'aali E mu vave lenei mea pe a showvalaʻau le auala faʻataʻitaʻiga.
faaalia O lenei mea e tupu pe a faʻaalia se elemene paʻu i le tagata faʻaoga (o le a faʻatali mo suiga css e maeʻa).
lalafi O lenei mea na tupu e faʻamalo vave pe a hidevalaʻau le metotia.
natia O lenei mea e tupu pe a natia se elemene pa'ū mai le tagata faʻaoga (o le a faʻatali mo suiga css e maeʻa).
  1. $ ( '#myCollapsible' ). i luga ( 'natia' , galuega () {
  2. // fai se mea...
  3. })

Faataitaiga

O se mea fa'apipi'i faigofie fa'alautele mo le vave faia o mataitusi mata'itusi ma so'o se fa'aoga tusitusiga.

  1. <input type = "text" data-provide = "typeahead" >

E te mana'o e fa'atulaga autocomplete="off"e puipuia mai le fa'aalia o menus su'esu'e le fa'aalia i luga o le fa'aulu i lalo o le ta'itusi Bootstrap.


Fa'aoga

E ala i fa'amaumauga uiga

Fa'aopoopo uiga fa'amaumauga e fa'amauina ai se elemene ma le fa'aogaina o le mataitusi e pei ona fa'aalia i le fa'ata'ita'iga i luga.

E ala i le JavaScript

Valaau ma le lima le mataitusi ma:

  1. $ ( '.typeahead' ). mataitusi ()

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-, pei o le data-source="".

Igoa ituaiga faaletonu fa'amatalaga
puna fa'asologa, galuega [ ] Le puna o fa'amatalaga e fesiligia. Atonu o se fa'asologa o manoa po'o se galuega. O le galuega e pasia ni finauga se lua, o le querytau i totonu o le fanua faʻaoga ma le processtoe foʻi. E mafai ona fa'aoga fa'atasi le galuega e ala i le toe fa'afo'i sa'o mai o fa'amatalaga fa'amatalaga po'o le fa'atasi e ala i le processfinauga e tasi a le callback.
mea numera 8 Le numera maualuga o mea e fa'aalia i le pa'ū.
minUumi numera 1 Ole umi ole amio e mana'omia a'o le'i fa'aosoina fautuaga fa'amae'a
fa'atusa galuega faatino mata'upu e le maaleale Le auala e fa'aaoga e iloa ai pe fetaui se fesili ma se mea. Talia se finauga e tasi, o le itemtetee e su'e ai le fesili. Avanoa ile fesili o iai nei ile this.query. Fa'afo'i se boolean truepe afai o le fesili e fetaui.
fa'avasega galuega faatino fetaui tonu,
mata'upu mata'utia, mata'itusi le
maaleale
Metotia na fa'aaoga e fa'avasega ai fa'amae'a fa'amae'a. Talia se finauga e tasi itemsma ei ai le lautele o le faʻataʻitaʻiga o le mataitusi. Fa'asino le fesili o iai nei ile this.query.
fa'afouga galuega faatino toe faafoi mea filifilia Le auala na faʻaaogaina e toe faʻafoʻi ai mea ua filifilia. Talia se finauga e tasi, o le itemma e iai le lautele o le fa'ata'ita'iga mataitusi.
fa'ailoga galuega faatino fa'amanino uma fetauiga fa'aletonu Metotia na fa'aaoga e fa'ailoa ai fa'ai'uga fa'amae'a. Talia se finauga e tasi itemma ei ai le lautele o le faʻataʻitaʻiga o le mataitusi. E tatau ona toe faafoi html.

Metotia

.typeahead(filifiliga)

Fa'amataina se fa'aoga i se mataitusi.

Faataitaiga

O le subnavigation i le agavale o se faʻaaliga ola o le faʻapipiʻi faʻapipiʻi.


Fa'aoga

E ala i fa'amaumauga uiga

Ina ia faigofie ona faʻapipiʻi amioga i soʻo se elemene, naʻo le faʻaopoopo data-spy="affix"i le elemene e te manaʻo e sipai ai. Ona fa'aoga lea o offsets e fa'amatala ai le taimi e sui ai le pine o se elemene i luga ma tape.

  1. <div data-spy = "affix" data-offset-top = "200" > ... </div>
Ulu i luga! E tatau ona e pulea le tulaga o se elemene pine ma le amio a lona matua matua. O le tulaga e pulea e affix, affix-top, ma affix-bottom. Manatua e siaki se matua e ono pa'u pe a oso i totonu le fa'apipi'i a'o aveese mea mai le tafe masani o le itulau.

E ala i le JavaScript

Valaau le affix plugin e ala i le JavaScript:

  1. $ ( '#navbar' ). fa'amau ()

Filifiliga

O filifiliga e mafai ona pasia e ala i faʻamatalaga uiga poʻo le JavaScript. Mo fa'amatalaga uiga, fa'aopoopo le igoa filifiliga i le data-, pei o le data-offset-top="200".

Igoa ituaiga faaletonu fa'amatalaga
fa'apena numera | galuega | mea faitino 10 Pixels e fa'asolo mai le lau pe a fa'atatau le tulaga o le ta'ai. Afai e tu'uina atu se numera tasi, o le a fa'aoga le offset i itu i luga ma agavale. Ina ia faʻalogo mo se faʻatonuga se tasi, poʻo le tele o faʻasalaga tulaga ese, naʻo le tuʻuina atu o se mea offset: { x: 10 }. Fa'aaoga se galuega pe a mana'omia le tu'uina atu ma le malosi o se offset (fa'aoga mo nisi fa'ata'ita'iga tali mai).