JavaScript

Hunza zvinhu zveBootstrap kuhupenyu-ikozvino ne13 tsika jQuery plugins.

Musoro! Mapepa aya ndee v2.3.2, iyo isingachatsigirwi zviri pamutemo. Tarisa uone yazvino vhezheni yeBootstrap!

Mumwe nemumwe kana kuunganidzwa

Mapulagi anogona kuverengerwa ega (kunyangwe mamwe akada zvinoenderana), kana zvese kamwechete. Ose ari maviri bootstrap.js uye bootstrap.min.js ane ese maplugins mufaira rimwe chete.

Data attribute

Unogona kushandisa ese Bootstrap plugins chete kuburikidza neiyo markup API pasina kunyora mutsara mumwechete weJavaScript. Iyi ndiyo Bootstrap yekutanga kirasi API uye inofanirwa kuve yako yekutanga kufunga kana uchishandisa plugin.

Izvozvo zvakati, mune mamwe mamiriro ezvinhu zvingave zvinodiwa kudzima basa iri. Naizvozvo, isu tinopawo kugona kudzima iyo data attribute API nekusunungura zvese zviitiko pane body namespaced ne `'data-api'`. Izvi zvinotaridzika seizvi:

  1. $ ( 'muviri' ). kudzimwa ( '.data-api' )

Neimwe nzira, kunanga imwe plugin, ingo sanganisira zita replugin sezita rezita pamwe chete nedata-api namespace seizvi:

  1. $ ( 'muviri' ). kudzimwa ( '.alert.data-api' )

Purogiramu yepurogiramu

Isu tinotenda zvakare kuti unofanirwa kukwanisa kushandisa ese Bootstrap plugins kuburikidza neJavaScript API. MaAPI ese eruzhinji inzira imwechete, inobatika, uye inodzosa kuunganidzwa kwaitwa.

  1. $ ( ".btn.danger" ). bhatani ( "toggle" ). addClass ( "mafuta" )

Nzira dzese dzinofanirwa kugamuchira chinhu chekusarudza sarudzo, tambo inonangana neimwe nzira, kana hapana (iyo inotanga plugin ine default maitiro):

  1. $ ( "#myModal" ). modal () // yakatanga nema defaults
  2. $ ( "#myModal" ). modal ({ keyboard : false }) // yakatanga isina kiibhodhi
  3. $ ( "#myModal" ). modal ( 'show' ) // inotanga uye invokes kuratidza pakarepo

Imwe neimwe plugin zvakare inofumura mugadziri wayo mbishi pane `Constructor` pfuma: $.fn.popover.Constructor. Kana iwe uchida kuwana imwe plugin muenzaniso, itore zvakananga kubva kune chinhu: $('[rel=popover]').data('popover').

Hapana Kupokana

Dzimwe nguva zvinodikanwa kushandisa Bootstrap plugins nemamwe maUI maficha. Mumamiriro ezvinhu aya, kudhumhana kwemazita kunogona kuitika dzimwe nguva. Kana izvi zvikaitika, unogona kufonera .noConflictplugin yaunoda kudzorera kukosha kwayo.

  1. var bootstrapButton = $ . fn . bhatani . noConflict () // dzorera $.fn.button kune yakambopiwa kukosha
  2. $ . fn . bootstrapBtn = bootstrapButton // ipa $() .bootstrapBtn basa rebootstrap

Zviitiko

Bootstrap inopa zviitiko zvetsika kune akawanda plugin akasarudzika zviito. Kazhinji, izvi zvinouya muchimiro chechirevo chisingaperi uye chekare - apo chisingaperi (ex. show) chinotangwa pakutanga kwechiitiko, uye chimiro chayo chekare (ex. shown) chinokonzeresa pakupedzwa kwechiito.

Zvese zvisingaperi zviitiko zvinopa kudziviriraDefault kushanda. Izvi zvinopa kugona kumisa kuitwa kwechiito chisati chatanga.

  1. $ ( '#myModal' ). pa ( 'show' , basa ( e ) {
  2. kana (! data ) dzoka e . kudziviriraDefault () // inomisa modal kubva kuratidzwa
  3. })

Nezvekuchinja

Kuti uite shanduko iri nyore, sanganisira bootstrap-transition.js kamwe padivi pemamwe mafaera eJS. Kana uri kushandisa compiled (kana minified) bootstrap.js , hapana chikonzero chekuisa izvi-zvatovepo.

Shandisa makesi

Mienzaniso mishoma yeshanduko plugin:

  • Kutsvedza kana kupera mumamodhi
  • Kudzima ma tabo
  • Zviyedzo zvinopera
  • Sliding carousel panes

Mienzaniso

Modals inogadziridzwa, asi inoshanduka, dialog inokurudzira ine hushoma hunodiwa mashandiro uye smart defaults.

Muenzaniso wakasimba

A revered modal ine musoro, muviri, uye seti yezviito munyasi.

  1. <div class = "modal hide fade" >
  2. <div kirasi = "modal-header" >
  3. <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </ button>
  4. <h3> Modal musoro </h3>
  5. </ div>
  6. <div kirasi = "modal-muviri" >
  7. <p> Muviri mumwe wakanaka… </p>
  8. </ div>
  9. <div kirasi = "modal-footer" >
  10. <a href = "#" class = "btn"> Vhara </a> _
  11. <a href = "#" class = "btn btn-primary"> Chevha shanduko </a>
  12. </ div>
  13. </ div>

Live demo

Shandura modal kuburikidza neJavaScript nekudzvanya bhatani riri pazasi. Ichatsvedza pasi uye kupera mukati kubva kumusoro kwepeji.

  1. <!-- Bhatani rekutanga modal -->
  2. <a href = "#myModal" role = "button" class = "btn" data-toggle = "modal"> Tangisa demo modal </a>
  3.  
  4. <!-- Modal -->
  5. <div id = "myModal" class = "modal hide fade" tabindex = "-1" role = "dialog" aria-labelledby = "myModalLabel" aria-hidden = "chokwadi" >
  6. <div kirasi = "modal-header" >
  7. <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true" > × </button>
  8. <h3 id = "myModalLabel" > Modal musoro </h3>
  9. </ div>
  10. <div kirasi = "modal-muviri" >
  11. <p> Muviri mumwe wakanaka… </p>
  12. </ div>
  13. <div kirasi = "modal-footer" >
  14. <button class = "btn" data-dismiss = "modal" aria-hidden = "true" > Vhara </button>
  15. <button class = "btn btn-primary" > Chengetedza shanduko </button>
  16. </ div>
  17. </ div>

Usage

Via data hunhu

Shandisa modal pasina kunyora JavaScript. Gadzirisa data-toggle="modal"chinhu chekutonga, sebhatani, pamwe chete nea data-target="#foo"kana href="#foo"kunanga imwe modhi yekushandura.

  1. <button type = "bhatani" data-toggle = "modal" data-target = "#myModal" > Tanga modal </button>

Via JavaScript

Fonera modal ine id myModaline mutsara mumwechete weJavaScript:

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

Options

Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-, semu data-backdrop="".

Zita type default tsananguro
kumashure boolean chokwadi Inosanganisira modal-backdrop element. Neimwe nzira, tsanangura statickune yekumashure iyo isingavhare modal pakudzvanya.
keyboard boolean chokwadi Inovhara modal kana kiyi yekutiza ikadzvanywa
show boolean chokwadi Inoratidza modal kana yatangwa.
kure nzira nhema

Kana url iri kure ikapihwa, zvirimo zvinoiswa kuburikidza nejQuery's loadnzira uye inobaiwa mu .modal-body. Kana iwe uri kushandisa iyo data api, iwe unogona neimwe nzira kushandisa iyo hrefteki kutsanangura kure kwainobva. Muenzaniso weizvi unoratidzwa pasi apa:

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

Nzira

.modal(sarudzo)

Inomisa zvirimo zvako se modal. Inobvuma sarudzo dzaungada object.

  1. $ ( '#myModal' ). modhi ({
  2. keyboard : nhema
  3. })

.modal('toggle')

Pamaoko anoshandura modal.

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

.modal('show')

Nemaoko anovhura modal.

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

.modal('hide')

Anozvivanza modal.

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

Zviitiko

Bootstrap's modal kirasi inofumura zviitiko zvishoma zvekukochekera kuita modal mashandiro.

Chiitiko Tsanangudzo
show Ichi chiitiko chinopisa nekukasira kana shownzira yemuenzaniso inodanwa.
kuratidzwa Ichi chiitiko chinodzingwa kana modal yaitwa kuti ionekwe kumushandisi (inomirira kuti css shanduko ipedze).
hide Ichi chiitiko chinodzingwa nekukasira kana iyo hidemuenzaniso nzira yadaidzwa.
zvakavanzika Ichi chiitiko chinodzingwa kana modal yapedza kuvanzwa kubva kumushandisi (inomirira css shanduko kuti ipedze).
  1. $ ( '#myModal' ). pa ( 'zvakavanzika' , basa () {
  2. // ita chimwe chinhu…
  3. })

Muenzaniso mu navbar

Iyo ScrollSpy plugin ndeyekugadzirisa otomatiki zvinangwa zve nav zvichienderana nenzvimbo yekupumburudza. Skrodza nzvimbo iri pazasi pebhari uye tarisa iyo inoshanda kirasi shanduko. Izvo zvinodonhedza sub zvinhu zvicharatidzwa zvakare.

@mafuta

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi vasati vatengesa izvo. Tumblr purazi-ku-tafura kodzero dzebhasikoro chero. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui pamwe hausati wanzwa nezvavo et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

@mdo

Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork ndebvu. Freegan ndebvu aliqua cupidatat mcsweeney's vero. Cupidatat mana ako ini, ea helvetica nulla carles. Tattooed cosby sweater chikafu rori, 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.

Poshi

Occaecat commodo aliqua deelectus. Fap craft doro deserunt skateboard ea. Lomo bhasikoro kodzero adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. Hupenyu hwepamusoro id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, inogara yakasimba deelectus consectetur fanny pack iphone.

piri

In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.

three

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

Keytar twee blog, culpa messenger bag marfa chero deelectus chikafu rori. Sapiente synth id imaginenda. Locavore sed helvetica cliche irony, mabhanan'ana iwe pamwe hausati wanzwa nezvawo consequat hoodie gluten-isina lo-fi fap aliquip. Labore elit placeat vasati vatengesa, 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.


Usage

Via data hunhu

Kuti uwedzere nyore scrollspy maitiro kune yako topbar navigation, ingo wedzera data-spy="scroll"kune chinhu chaunoda kunosora (kazhinji uyu unenge uri muviri) uye data-target=".navbar"kusarudza kuti ndeipi nav yekushandisa. Iwe unozoda kushandisa scrollspy nechikamu .nav.

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

Via JavaScript

Fonera iyo scrollspy kuburikidza neJavaScript:

  1. $ ( '#navbar' ). scrollspy ()
Musoro! Navbar links dzinofanirwa kunge dziine zvinogadziriswa id zvinangwa. Semuenzaniso, <a href="#home">home</a>inofanirwa kuenderana nechimwe chinhu chiri mudom senge <div id="home"></div>.

Nzira

.scrollpy('refresh')

Paunenge uchishandisa scrollspy pamwe nekuwedzera kana kubvisa zvinhu kubva kuDOM, iwe unozofanirwa kufonera nzira yekuzorodza senge:

  1. $ ( '[data-spy="scroll"]' ). chimwe nechimwe ( basa () {
  2. var $ spy = $ ( iyi ). scrollspy ( 'refresh' )
  3. });

Options

Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-, semu data-offset="".

Zita type default tsananguro
offset nhamba 10 Mapikisi ekubvisa kubva kumusoro paunenge uchiverenga nzvimbo yekupumburudza.

Zviitiko

Chiitiko Tsanangudzo
activate Chiitiko ichi chinopisa chero chinhu chitsva chikavhurwa neiyo scrollspy.

Muenzaniso tabs

Wedzera nekukurumidza, kusimba kwetabhu kushanda kwekuchinja kuburikidza nemapaneru ezvemukati zvemukati, kunyangwe kuburikidza nekudonhedza menyu.

Raw denim pamwe hausati wanzwa nezvavo zvipfupi zvejean 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. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, 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.


Usage

Gonesa tabable tabs kuburikidza neJavaScript (tebhu yega yega inoda kuvhurwa yega):

  1. $ ( '#myTab a' ). tinya ( basa ( e ) {
  2. e . kudziviriraDefault ();
  3. $ ( izvi ). tab ( 'kuratidza' );
  4. })

Iwe unogona kumisa ma tabo ega ega munzira dzinoverengeka:

  1. $ ( '#myTab a[href="#profile"]' ). tab ( 'kuratidza' ); // Sarudza tab nezita
  2. $ ( '#myTab a:first' ). tab ( 'kuratidza' ); // Sarudza yekutanga tab
  3. $ ( '#myTab a:kupedzisira' ). tab ( 'kuratidza' ); // Sarudza yekupedzisira tab
  4. $ ( '#myTab li:eq(2) a' ). tab ( 'kuratidza' ); // Sarudza yechitatu tebhu (0-indexed)

Markup

Unogona kumisikidza tebhu kana piritsi kufamba usinganyore chero JavaScript nekungotsanangura data-toggle="tab"kana data-toggle="pill"pane chinhu. Kuwedzera iyo navuye nav-tabsmakirasi kune iyo tebhu ulichashandisa iyo Bootstrap tebhu styling.

  1. <ul class = "nav nav-tabs" >
  2. <li><a href = "#home" data-toggle = "tab"> Kumba </a></li >
  3. <li><a href = "#profile" data-toggle = "tab"> Profile </a></li >
  4. <li><a href = "#messages" data-toggle = "tab"> Mameseji </a> </li >
  5. <li><a href = "#settings" data-toggle = "tab"> Zvirongwa </a></li >
  6. </ul>

Nzira

$().tab

Inomisikidza chinhu chetabhu uye mudziyo wemukati. Tab inofanirwa kunge iine data-targetkana hrefyakanangana nemudziyo node muDOM.

  1. <ul class = "nav nav-tabs" id = "myTab" >
  2. <li class = "active" ><a href = "#home"> Kumba </a></li >
  3. <li><a href = "#profile"> Profile </a> </li>
  4. <li><a href = "#messages"> maMessages </a> </li>
  5. <li><a href = "#settings"> Zvirongwa </a> </li>
  6. </ul>
  7.  
  8. <div class = "tab-content" >
  9. <div class = "tab-pane inoshanda" id = "kumba" > ... </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. $ ( basa () {
  17. $ ( '#myTab a:kupedzisira' ). tab ( 'kuratidza' );
  18. })
  19. </script>

Zviitiko

Chiitiko Tsanangudzo
show Ichi chiitiko chinopisa pane tab show, asi iyo itsva tebhu isati yaratidzwa. Shandisa event.targetuye event.relatedTargetkunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana.
kuratidzwa Ichi chiitiko chinopisa pane tab show mushure mekunge tab yaratidzwa. Shandisa event.targetuye event.relatedTargetkunanga iyo inoshanda tebhu uye yapfuura inoshanda tebhu (kana iripo) zvichiteerana.
  1. $ ( 'a[data-toggle="tab"]' ). pa ( 'inoratidzwa' , basa ( e ) {
  2. e . chinangwa // activated tab
  3. e . yakabatanaTarget // yapfuura tab
  4. })

Mienzaniso

Yakafuridzirwa neyakanakisa jQuery.tipsy plugin yakanyorwa naJason Frame; Maturusi ivhezheni yakagadziridzwa, isingavimbi nemifananidzo, shandisa CSS3 yemifananidzo, uye data-maitiro ekuchengetera mazita enzvimbo.

Nekuda kwezvikonzero zvekuita, iyo tooltip uye popover data-apis vanopinda, zvichireva kuti unofanira kuzvitangisa iwe pachako .

Hover pamusoro pemalink ari pasi apa kuti uone maturusi ekushandisa:

Tight bhurugwa next level keffiyeh pamwe hausati wanzwa nezvavo. Photo booth ndebvu mbishi denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american nguo ine terry richardson vinyl chambray. Ndebvu stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, mana loko mcsweeney's cleanse vegan chambray. A really artisan artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.

Nzira ina

Zvishandiso mumapoka ekuisa

Paunenge uchishandisa maturusi uye popovers neBootstrap ekuisa mapoka, iwe unofanirwa kuseta iyo container(yakanyorwa pazasi) sarudzo kudzivirira zvisingadiwe mhedzisiro.


Usage

Tamba chishandiso kuburikidza neJavaScript:

  1. $ ( '#muenzaniso' ). tooltip ( sarudzo )

Options

Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-, semu data-animation="".

Zita type default tsananguro
animation boolean chokwadi shandisa css fade shanduko kune tooltip
html boolean nhema Isa html muchokushandisa. Kana nhema, nzira yejquery textichashandiswa kuisa zvirimo mudom. Shandisa zvinyorwa kana uchinetseka nezve XSS kurwiswa.
kuiswa tambo | basa 'pamusoro' nzira yekuisa iyo tooltip - pamusoro | pasi | left | rudyi
selector tambo nhema Kana sarudzo yakapihwa, zviro zveturusi zvinopihwa kune izvo zvakatarwa.
title tambo | basa '' default title value kana `title` tag isipo
trigger tambo 'hover focus' kuti tooltip inotangwa sei - tinya | hovha | focus | manual. Ziva iwe kesi pass trigger mutliple, nzvimbo yakakamurwa, trigger mhando.
delay nhamba | object 0

kunonoka kuratidza uye kuvanza iyo tooltip (ms) - haishande kune manual trigger type

Kana nhamba yapihwa, kunonoka kunoiswa kune ese ari maviri hide/show

Chimiro chechinhu ndeichi:delay: { show: 500, hide: 100 }

mudziyo tambo | nhema nhema

Inoisa tip kune chimwe chinhucontainer: 'body'

Musoro! Sarudzo dzematurusi ega ega dzinogona kutsanangurwa neimwe nzira kuburikidza nekushandisa data hunhu.

Markup

  1. <a href = "#" data-toggle = "tooltip" title = "tooltip yekutanga"> tenderera pamusoro pangu </a>

Nzira

$().tip(sarudzo)

Inonamira chibatiso cheturusi kune muunganidzwa wezvinhu.

.tooltip('show')

Inoratidza chekushandisa chechinhu.

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

.tooltip('hide')

Inovanza zano rekushandisa.

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

.tooltip('toggle')

Inoshandura matipi echinhu.

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

.tooltip('paradza')

Inoviga nekuparadza mudziyo wekushandisa.

  1. $ ( '#element' ). tooltip ( 'paradza' )

Mienzaniso

Wedzera zvidiki zvakafukidzwa zvemukati, sezviya zviri paPadad, kune chero chinhu cheimba yechipiri ruzivo. Famba pamusoro pebhatani kuti utange popover. Inoda Tooltip kuti ibatanidzwe.

Static popover

Sarudzo ina dziripo: kumusoro, kurudyi, pasi, uye kuruboshwe zvakaenderana.

Popover pamusoro

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

Popover kurudyi

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

Popover pasi

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

Popover akaenda

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

Hapana markup inoratidzwa sepopovers inogadzirwa kubva kuJavaScript uye zviri mukati datamehunhu.

Live demo

Nzira ina


Usage

Gonesa mapopovers kuburikidza neJavaScript:

  1. $ ( '#muenzaniso' ). popover ( sarudzo )

Options

Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-, semu data-animation="".

Zita type default tsananguro
animation boolean chokwadi shandisa css fade shanduko kune tooltip
html boolean nhema Isa html mune popover. Kana nhema, nzira yejquery textichashandiswa kuisa zvirimo mudom. Shandisa zvinyorwa kana uchinetseka nezve XSS kurwiswa.
kuiswa tambo | basa 'rudyi' maitiro ekuisa popover - kumusoro | pasi | left | rudyi
selector tambo nhema kana sarudzo yakapihwa, zviro zveturusi zvinopihwa kune izvo zvakatarwa
trigger tambo 'tinya' kuti popover inokonzereswa sei - tinya | hovha | focus | manual
title tambo | basa '' default title value kana `title` hunhu asipo
content tambo | basa '' default content value kana `data-content` asipo
delay nhamba | object 0

kunonoka kuratidza uye kuvanza iyo popover (ms) - haishande kune manual trigger type

Kana nhamba yapihwa, kunonoka kunoiswa kune ese ari maviri hide/show

Chimiro chechinhu ndeichi:delay: { show: 500, hide: 100 }

mudziyo tambo | nhema nhema

Inoisa popover kune chimwe chinhucontainer: 'body'

Musoro!Sarudzo dzemapopovers ega dzinogona kutsanangurwa neimwe nzira kuburikidza nekushandisa data hunhu.

Markup

Nekuda kwezvikonzero zvekuita, Tooltip nePopover data-apis vanosarudza kupinda. Kana uchida kuzvishandisa ingotaura sarudzo yekusarudza.

Nzira

$().popover(sarudzo)

Inotanga popover yekuunganidza zvinhu.

.popover('show')

Inoburitsa zvinhu popover.

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

.popover('hide')

Inoviga zvinhu zvinobuda.

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

.popover('toggle')

Toggles an elements popover.

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

.popover('destroy')

Inoviga uye inoparadza popover yechinhu.

  1. $ ( '#element' ). popover ( 'paradza' )

Muenzaniso chenjedzo

Wedzera mashandiro ekudzinga kune ese mameseji echenjedzo ane plugin iyi.

Holy guacamole! Best check yo self, hausi kunyanyonaka.

Oh snap! Wawana kukanganisa!

Chinja ichi neicho uye edza zvakare. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

Ita chiito ichi Kana kuti ita izvi


Usage

Ita kuti chenjedzo iraswe kuburikidza neJavaScript:

  1. $ ( ".alert" ). chenjerera ()

Markup

Ingo wedzera data-dismiss="alert"kune yako bhatani rekuvhara kuti upe otomatiki yambiro yepedyo kushanda.

  1. <a class = "close" data-dismiss = "alert" href = "#" > × </a>

Nzira

$().chenjedzo()

Inopeta chenjedzo dzese nekushanda kwepedyo. Kuti zviziviso zvako zvibude kana zvakavharwa, ita shuwa kuti vane .fadeuye .inkirasi yatoiswa kwazviri.

.alert('kuvhara')

Inovhara chenjedzo.

  1. $ ( ".alert" ). chenjedzo ( 'vhara' )

Zviitiko

Bootstrap's alert kirasi inofumura zviitiko zvishoma zvekukochekera mukuita kweyambiro.

Chiitiko Tsanangudzo
pedyo Ichi chiitiko chinopisa nekukasira kana closenzira yemuenzaniso inodanwa.
yakavharwa Ichi chiitiko chinodzingwa kana yambiro yavharwa (ichamirira css shanduko kuti ipedze).
  1. $ ( '#my-alert' ). sunga ( 'yakavharwa' , basa () {
  2. // ita chimwe chinhu…
  3. })

Mienzaniso inoshandiswa

Ita zvakawanda nemabhatani. Kudzora bhatani rinotaura kana kugadzira mapoka emabhatani ezvimwe zvinhu zvakaita sematurusi.

Stateful

Wedzera data-loading-text="Loading..."kushandisa mamiriro ekurodha pane bhatani.

  1. <button type = "button" class = "btn btn-primary" data-loading-text = "Kutakura..." > Kurodha mamiriro </button>

Single toggle

Wedzera data-toggle="button"ku activate toggling pane rimwe bhatani.

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

Checkbox

Wedzera data-toggle="buttons-checkbox"bhokisi rekutarisa kushandura pabtn-boka.

  1. <div class = "btn-group" data-toggle = "mabhatani-checkbox" >
  2. <button type = "button" class = "btn btn-primary" > Kuruboshwe </button>
  3. <button type = "button" class = "btn btn-primary" > Pakati </button>
  4. <button type = "button" class = "btn btn-primary" > Right </button>
  5. </ div>

Radio

Wedzera data-toggle="buttons-radio"kune redhiyo style toggling pabtn-group.

  1. <div class = "btn-group" data-toggle = "mabhatani-redhiyo" >
  2. <button type = "button" class = "btn btn-primary" > Kuruboshwe </button>
  3. <button type = "button" class = "btn btn-primary" > Pakati </button>
  4. <button type = "button" class = "btn btn-primary" > Right </button>
  5. </ div>

Usage

Vhura mabhatani kuburikidza neJavaScript:

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

Markup

Mamiriro e data akakosha kune bhatani plugin. Tarisa kodhi yemuenzaniso pazasi yemhando dzakasiyana dzemakapu.

Options

Hapana

Nzira

$().bhatani('toggle')

Toggles push state. Inopa bhatani kutaridzika kuti rakaitwa.

Musoro! Unogona kugonesa auto toggling yebhatani uchishandisa data-togglehunhu.
  1. <button type = "button" class = "btn" data-toggle = "bhatani" > </button>

$().bhatani('loading')

Gadzirisa bhatani mamiriro ekurodha - inodzima bhatani uye kuchinjanisa mavara kuti atakure mavara. Kurodha mavara kunofanirwa kutsanangurwa pane bhatani chinhu uchishandisa data hunhu data-loading-text.

  1. <button type = "button" class = "btn" data-loading-text = "kurodha zvinhu..." > ... </button>
Musoro! Firefox inorambira iyo yakaremara mamiriro emapeji ese . A workaround yeiyi ndeye kushandisa autocomplete="off".

$().bhatani('reset')

Reset mamiriro ebhatani - kuchinjanisa mavara kune mavara ekutanga.

$().bhatani(tambo)

Resets bhatani mamiriro - swaps mavara kune chero data yakatsanangurwa mameseji mamiriro.

  1. <button type = "button" class = "btn" data-complete-text = "yapera!" > ... </ button>
  2. <script>
  3. $ ( '.btn' ). bhatani ( 'zvakakwana' )
  4. </script>

About

Tora masitaera epasi uye inochinjika tsigiro yezvinhu zvinoputsika senge maaccordion uye kufamba.

* Inoda iyo Transitions plugin kuti ibatanidzwe.

Muenzaniso accordion

Tichishandisa iyo yekudonha plugin, isu takavaka yakapusa accordion style widget:

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf mwedzi officia aute, kwete cupidatat skateboard dolor brunch. Rori yechikafu quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua isa shiri pairi squid single-origin coffee nulla imaginenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan kunzeeur butcher vice lomo. Leggings occaecat craft doro purazi-ku-tafura, mbishi denim aesthetic synth nesciunt iwe ungangove usati wanzwa nezvavo kupomera basa rakagadzikana VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf mwedzi officia aute, kwete cupidatat skateboard dolor brunch. Rori yechikafu quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua isa shiri pairi squid single-origin coffee nulla imaginenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan kunzeeur butcher vice lomo. Leggings occaecat craft doro purazi-ku-tafura, mbishi denim aesthetic synth nesciunt iwe ungangove usati wanzwa nezvavo kupomera basa rakagadzikana VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf mwedzi officia aute, kwete cupidatat skateboard dolor brunch. Rori yechikafu quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua isa shiri pairi squid single-origin coffee nulla imaginenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan kunzeeur butcher vice lomo. Leggings occaecat craft doro purazi-ku-tafura, mbishi denim aesthetic synth nesciunt iwe ungangove usati wanzwa nezvavo kupomera basa rakagadzikana VHS.
  1. <div kirasi = "accordion" id = "accordion2" >
  2. <div kirasi = "accordion-boka" >
  3. <div kirasi = "accordion-heading" >
  4. <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne"> _
  5. Chinopindika Boka Chinhu #1
  6. </a>
  7. </ div>
  8. <div id = "collapseOne" kirasi = "accordion-muviri kudonha mukati" >
  9. <div kirasi = "accordion-mukati" >
  10. Anim pariatur cliche...
  11. </ div>
  12. </ div>
  13. </ div>
  14. <div kirasi = "accordion-boka" >
  15. <div kirasi = "accordion-heading" >
  16. <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo"> _
  17. Collapsible Boka Chinhu #2
  18. </a>
  19. </ div>
  20. <div id = "collapseTwo" kirasi = "accordion-body collapse" >
  21. <div kirasi = "accordion-mukati" >
  22. Anim pariatur cliche...
  23. </ div>
  24. </ div>
  25. </ div>
  26. </ div>
  27. ...

Iwe unogona zvakare kushandisa plugin pasina accordion markup. Gadzira bhatani kushandura kuwedzera uye kudonha kwechimwe chinhu.

  1. <button type = "bhatani" class = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
  2. simple collapsible
  3. </ button>
  4.  
  5. <div id = "demo" kirasi = "kudonha mukati" > </div>

Usage

Via data hunhu

Ingo wedzera data-toggle="collapse"uye data-targetkune chinhu kuti ugozvigadzika kutonga kwechinhu chinodonha. Hunhu data-targethunogashira css selector yekushandisa kuputsika. Iva nechokwadi chekuwedzera kirasi collapsekune chinhu chinoputika. Kana uchida kuti risavhurika, wedzera imwe kirasi in.

Kuwedzera accordion-senge boka manejimendi kune inodonha kutonga, wedzera iyo data hunhu data-parent="#selector". Tarisa kune demo kuti uone izvi mukuita.

Via JavaScript

Vhura nemaoko ne:

  1. $ ( ".collapse" ). kuputsika ()

Options

Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-, semu data-parent="".

Zita type default tsananguro
mubereki selector nhema Kana sesarudzi zvino zvese zvinopeta pasi pemubereki wataurwa zvichavharwa kana chinhu chinopetana ichi charatidzwa. (zvakafanana nemaitiro echinyakare accordion)
toggle boolean chokwadi Inoshandura chinhu chinopeta pakukumbira

Nzira

.collapse(sarudzo)

Inobatisa zvirimo sechinhu chinogoneka. Inobvuma sarudzo dzaungada object.

  1. $ ( '#myCollapsible' ). kuparara ({
  2. toggle : nhema
  3. })

.collapse('toggle')

Inoshandura chinhu chinopeta kuti chiratidze kana kuvanzwa.

.collapse('show')

Inoratidza chinhu chinopeta.

.collapse('hide')

Inoviga chinhu chinopeta.

Zviitiko

Bootstrap's kudonha kirasi inofumura zviitiko zvishoma zvekukochekera mukudonha kushanda.

Chiitiko Tsanangudzo
show Ichi chiitiko chinopisa nekukasira kana shownzira yemuenzaniso inodanwa.
kuratidzwa Ichi chiitiko chinodzingwa kana chinhu chekudonha chaitwa kuti chionekwe kumushandisi (chichamirira css shanduko kuti ipedze).
hide Chiitiko ichi chinodzingwa pakarepo kana hidenzira yadaidzwa.
zvakavanzika Chiitiko ichi chinodzingwa kana chinhu chekudonha chakavigwa kubva kumushandisi (chinomirira css shanduko kuti ipedze).
  1. $ ( '#myCollapsible' ). pa ( 'zvakavanzika' , basa () {
  2. // ita chimwe chinhu…
  3. })

Muenzaniso

Yekutanga, yakawedzerwa zviri nyore plugin yekukurumidza kugadzira anoyevedza typeaheads nechero fomu yekunyora mameseji.

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

Iwe autocomplete="off"unozoda kuseta kudzivirira default browser mamenu kuti asaonekwe pamusoro peBootstrap typeahead kudonha.


Usage

Via data hunhu

Wedzera data hunhu kunyoresa chinhu chine typeahead mashandiro sezvakaratidzwa mumuenzaniso uri pamusoro.

Via JavaScript

Fonera iyo typeahead nemaoko ne:

  1. $ ( '.typeahead' ).typehead ()

Options

Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-, semu data-source="".

Zita type default tsananguro
source array, basa [ ] Data source yekubvunza nezvayo. Inogona kunge iri tambo dzakawanda kana basa. Basa racho rinopfuura nharo mbiri, querykukosha mundima yekupinza uye processcallback. Basa racho rinogona kushandiswa zvakawiriraniswa nekudzorera kwainobva data zvakananga kana kuti asynchronously kuburikidza processnecallback's single argument.
zvinhu nhamba 8 Huwandu hwezvinhu zvicharatidzwa mukudonhedza.
minLength nhamba 1 Hurefu hwemavara hudiki hunodiwa usati watanga mazano ekuzadzisa otomatiki
matcher basa nyaya isinganzwisisi Nzira inoshandiswa kuona kana mubvunzo uchienderana nechimwe chinhu. Inogamuchira nharo imwe chete, itemiyo yekuedza mubvunzo. Svika pane zvauri kutsvaga ne this.query. Dzosa boolean truekana mubvunzo uchienderana.
sorter basa machisi chaiwo,
nyaya
isinganzwisisike
Nzira yakashandiswa kugadzirisa mhinduro dzega. Inogamuchira nharo imwe chete itemsuye ine chiyero cheiyo typeahead muenzaniso. Revera mubvunzo wazvino ne this.query.
updater basa inodzorera chinhu chakasarudzwa Nzira yakashandiswa kudzosera chinhu chakasarudzwa. Inogamuchira nharo imwe chete, iyo itemuye ine chiyero cheiyo typeahead muenzaniso.
highlighter basa inosimbisa ese machisi akasarudzika Nzira yakashandiswa kuratidza mhinduro dzakakwana. Inogamuchira nharo imwe chete itemuye ine chiyero cheiyo typeahead muenzaniso. Inofanira kudzorera html.

Nzira

.typeahead(sarudzo)

Inotanga inopinza ine typeahead.

Muenzaniso

Iyo subnavigation kuruboshwe idemo mhenyu yeaffix plugin.


Usage

Via data hunhu

Kuti uwedzere nyore affix maitiro kune chero chinhu, ingo wedzera data-spy="affix"kune chinhu chaunoda kunosora. Wobva washandisa maoffset kutsanangura nguva yekushandura kupinza kwechinhu nekudzima.

  1. <div data-spy = "affix" data-offset-top = "200" > ... </div>
Musoro! Iwe unofanirwa kubata chinzvimbo chechinhu chakapiniwa uye maitiro emubereki wacho wepedyo. Chinzvimbo chinodzorwa ne affix, affix-top, uye affix-bottom . Rangarira kutarisa mubereki angangodonha kana affix ichipinda mukati sezvo ichibvisa zvirimo kubva kune yakajairika kuyerera kwepeji.

Via JavaScript

Fonera iyo affix plugin kuburikidza neJavaScript:

  1. $ ( '#navbar' ). simbisa ()

Options

Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-, semu data-offset-top="200".

Zita type default tsananguro
offset nhamba | basa | object 10 MaPixels ekubvisa kubva pachiratidziro kana uchiverenga chinzvimbo chemupumburu. Kana nhamba imwe chete yapihwa, iyo yekubvisa inozoiswa kumusoro nekuruboshwe nzira. Kuti uteerere gwara rimwe chete, kana akawanda akasiyana akasarudzika, ingopa chinhu offset: { x: 10 }. Shandisa basa kana iwe uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchinge uchingerwa offset (inobatsira kune mamwe anopindura magadzirirwo).