JavaScript

Leeta ebitundu bya Bootstrap mu bulamu-kati nga olina 13 custom jQuery plugins.

Emitwe gigulumivu! Docs zino za v2.3.2, ezitakyawagirwa mu butongole. Laba enkyusa ya Bootstrap eyasembyeyo!

Kinoomu oba ekikuŋŋaanyiziddwa

Plugins zisobola okuteekebwamu kinnoomu (wadde nga ezimu zeetaaga okwesigamizibwa), oba zonna omulundi gumu. bootstrap.js ne bootstrap.min.js zombi zirimu plugins zonna mu fayiro emu.

Ebintu ebikwata ku data

Osobola okukozesa Bootstrap plugins zonna okuyita mu markup API yokka nga towandiise layini emu eya JavaScript. Eno ye API ya Bootstrap eya kiraasi esooka era yandibadde esooka okulowoozaako ng’okozesa plugin.

Ekyo kyogeddwa, mu mbeera ezimu kiyinza okuba ekirungi okuggyako omulimu guno. Nolwekyo, era tuwa obusobozi okulemesa API attribute ya data nga tusumulula ebibaddewo byonna ku mubiri namespaced ne `'data-api'`. Kino kifaanana bwe kiti:

  1. $ ( 'omubiri' ). okuggyako ( '.data-api' ) .

Ekirala, okutunuulira plugin eyeetongodde, ssaamu erinnya lya plugin nga ekifo ky'amannya wamu n'ekifo ky'amannya kya data-api nga kino:

  1. $ ( 'omubiri' ). off ( '.okulabula.data-api' ) .

API ya pulogulaamu

Era tukkiriza nti olina okusobola okukozesa Bootstrap plugins zonna okuyita mu JavaScript API yokka. API zonna ez'olukale nkola emu, eziteekebwako enjegere, era zizzaayo okukung'aanya okwakolebwako.

  1. $ ( ".btn.akabi" ). button ( "okukyusakyusa" ). addClass ( "amasavu" ) .

Enkola zonna zirina okukkiriza ekintu eky'okulonda eky'okwesalirawo, olunyiriri olugenderera enkola entongole, oba tewali kintu kyonna (ekitandika plugin n'enneeyisa eya bulijjo):

  1. $ ( "#Modal yange" ). modal () // etandikiddwawo n'ebisookerwako
  2. $ ( "#Modal yange" ). modal ({ keyboard : false }) // etandikiddwawo nga tewali kibboodi
  3. $ ( "#Modal yange" ). modal ( 'show' ) // etandika era eyita okulaga amangu ddala

Buli plugin era eraga omuzimbi waayo embisi ku kintu kya `Constructor`: $.fn.popover.Constructor. Bw'oba oyagala okufuna ekifaananyi kya plugin ekimu, kiggye butereevu okuva mu elementi: $('[rel=popover]').data('popover').

Tewali Butakkaanya

Oluusi kyetaagisa okukozesa Bootstrap plugins ne UI frameworks endala. Mu mbeera zino, okutomeragana kw'ekifo ky'amannya kuyinza okubaawo oluusi n'oluusi. Kino bwe kibaawo, oyinza okuyita .noConflictku plugin gy’oyagala okuzzaawo omuwendo gwayo.

  1. var bootstrapButaamu = $ . fn . button . noConflict () // zzaayo $.fn.button ku muwendo ogwaweebwa emabegako
  2. $ . fn . bootstrapBtn = bootstrapButton // okuwa $().bootstrapBtn omulimu gwa bootstrap

Ebibaddewo

Bootstrap egaba ebibaddewo eby'enjawulo ku bikolwa ebisinga obungi eby'enjawulo ebya plugin. Okutwalira awamu, bino bijja mu ngeri etaliiko nkomerero n’enkomerero eyayita - nga enkomerero (ex. show) etandikibwawo ku ntandikwa y’ekintu ekibaawo, ate engeri yaayo ey’ekitundu ekiyise (ex. shown) n’etandika ku kumaliriza ekikolwa.

Ebibaawo byonna ebitaliiko nkomerero biwa enkola ya preventDefault. Kino kiwa obusobozi okuyimiriza okukola ekikolwa nga tekinnatandika.

  1. $ ( '#Modal yange' ). ku ( 'laga' , omulimu ( e ) {
  2. singa (! data ) okuddamu e . preventDefault () // eyimiriza modal okulagibwa
  3. }) .

Ebikwata ku nkyukakyuka

Ku bikolwa eby’enkyukakyuka ebyangu, ssaamu bootstrap-transition.js omulundi gumu ku mabbali ga fayiro za JS endala. Bw’oba ​​okozesa bootstrap.js ekung’aanyiziddwa (oba ekendeezeddwa) , tekyetaagisa kussaamu kino—kyaaliwo dda.

Kozesa emisango

Ebyokulabirako ebitonotono ku plugin y'enkyukakyuka:

  • Okusereba oba okuzikira mu modals
  • Okuzikira okuvaamu tabs
  • Okuzikira okulabula
  • Ebipande bya carousel ebiseeyeeya

Eby’okulabirako

Modals zirongooseddwa, naye nga zikyukakyuka, dialog prompts nga zirina enkola entono ezeetaagisa n'okusooka okugezi.

Ekyokulabirako ekitali kikyukakyuka

Modal ekoleddwa nga erimu omutwe, omubiri, n'ekibinja ky'ebikolwa mu wansi.

  1. <div class = "okuzikira kw'okukweka okw'engeri" >
  2. <div class = "omutwe-omuko" >
  3. < ekika kya button = "button" class = "okuggalawo" data-okugoba = "modal" aria-okukwekebwa = "kituufu" > × </button>
  4. <h3> Omutwe gwa modali </h3>
  5. </div> nga bwe kiri
  6. <div class = "omubiri-ogw'engeri" >
  7. <p> Omubiri gumu omulungi... </p>
  8. </div> nga bwe kiri
  9. <div class = "omutendera-ekigere" >
  10. <a href = "#" ekibiina = "btn" > Ggalawo </a>
  11. <a href = "#" class = "btn btn-primary" > Teeka enkyukakyuka </a>
  12. </div> nga bwe kiri
  13. </div> nga bwe kiri

Live demo

Toggle a modal nga oyita mu JavaScript nga onyiga button wansi. Kijja kuseeyeeya wansi era kizike okuva waggulu ku lupapula.

  1. <!-- Button okutandikawo modal -->
  2. <a href = "#myModal" role = "button" class = "btn" data-toggle = "engeri" > Okutongoza enkola y'okulaga </a>
  3.  
  4. <!-- Omukozi -->
  5. <div id = "myModal" class = "modal okukweka okuzikira" tabindex = "-1" omulimu = "okukubaganya ebirowoozo" aria-labelledby = "myModalLabel" aria-okukwekebwa = "kituufu" >
  6. <div class = "omutwe-omuko" >
  7. < ekika kya button = "button" class = "okuggalawo" data-okugoba = "modal" aria-okukwekebwa = "kituufu" > × </button>
  8. <h3 id = "myModalLabel" > Omutwe gwa Modal </h3>
  9. </div> nga bwe kiri
  10. <div class = "omubiri-ogw'engeri" >
  11. <p> Omubiri gumu omulungi... </p>
  12. </div> nga bwe kiri
  13. <div class = "omutendera-ekigere" >
  14. <button class = "btn" data-dismiss = "modal" aria-okukwekebwa = "kituufu" > Ggalawo </button>
  15. <button class = "btn btn-primary" > Teeka enkyukakyuka </button>
  16. </div> nga bwe kiri
  17. </div> nga bwe kiri

Enkozesa

Okuyita mu bikwata ku data

Kozesa modal nga towandiise JavaScript. Teeka data-toggle="modal"ku elementi y'ekifuga, nga button, wamu ne a data-target="#foo"oba href="#foo"okutunuulira modal eyeetongodde okukyusakyusa.

  1. < ekika kya button = "button" data-toggle = "modal" data-target = "#myModal" > Okutongoza enkola </button>

Okuyita mu JavaScript

Kuba modal eriko id myModalnga erina layini emu eya JavaScript:

  1. $ ( '#Modal yange' ). modal ( eby'okulondako ) .

Eby’okulondako

Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-, nga mu data-backdrop="".

Erinnya okuwandiika okukosamu okunnyonnyola
ekifaananyi eky’emabega boolean kituufu Mulimu ekintu ekiyitibwa modal-backdrop element. Ekirala, lambika staticku backdrop etaggalawo modal ku click.
ekitabo ekikwata ku kibboodi boolean kituufu Eggalawo modal nga escape key enyigiddwa
okulaga boolean kituufu Alaga modal nga etandikiddwawo.
limooti ekkubo -kyaamu

Singa url eri ewala eweebwa, ebirimu bijja kutikkibwa nga biyita mu loadnkola ya jQuery era bifukiddwa mu .modal-body. Bw'oba okozesa data api, oyinza mu ngeri endala okukozesa hreftag okulaga ensibuko y'ewala. Ekyokulabirako ku kino kiragiddwa wansi:

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

Enkola

.modal(ebyokulonda) .

Ekola ebirimu byo nga modal. Akkiriza eby'okulonda eby'okwesalirawo object.

  1. $ ( '#Modal yange' ). modal ({ ) .
  2. keyboard : eky'obulimba
  3. }) .

.modal('okukyusakyusa')

Mu ngalo ekyusakyusa modal.

  1. $ ( '#Modal yange' ). modal ( 'okukyusakyusa' ) .

.modal('laga') .

Mu ngalo aggulawo modal.

  1. $ ( '#Modal yange' ). modal ( 'okulaga' ) .

.modal('okukweka') .

Mu ngalo akweka modal.

  1. $ ( '#Modal yange' ). modal ( 'okukweka' ) .

Ebibaddewo

Bootstrap's modal class eraga ebitonotono ebibaawo olw'okuyunga mu nkola ya modal.

Omukolo Okunnyonnyola
okulaga Ekintu kino kikuba amangu ddala nga showenkola ya instance eyitiddwa.
eragiddwa Ekintu kino kikubwa nga modal ekoleddwa okulabika eri omukozesa (ejja kulinda enkyukakyuka za css okuggwa).
okweekweeka Ekintu kino kikubwa amangu ddala nga hideenkola ya instance eyitiddwa.
okukweekebwa Ekintu kino kikubwa nga modal emaze okukwekebwa okuva eri omukozesa (ejja kulinda enkyukakyuka za css okuggwa).
  1. $ ( '#Modal yange' ). ku ( 'ekikwekeddwa' , omulimu () { .
  2. // kola ekintu...
  3. }) .

Okugeza mu navbar

ScrollSpy plugin ya kulongoosa nav targets mu ngeri ey’otoma okusinziira ku scroll position. Ssenda ekitundu wansi wa navbar era olabe enkyukakyuka ya kiraasi ekola. Ebintu ebitonotono ebigwa wansi nabyo bijja kulagibwa.

@obunene

Ad leggings keytar, brunch id art akabaga ka dolor labore. Pitchfork yr enim lo-fi nga tebannaba kutunda qui. Tumblr eddembe ly'obugaali okuva ku faamu okutuuka ku mmeeza kyonna. Anim keffiyeh kaadi ya carles. Velit seitan mcsweeney's ekifaananyi ekifo 3 omusege omwezi irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui osanga toziwuliddeko et cardigan ssente z'obwesige culpa biodiesel wes anderson aesthetic. Nihil alina ttatu accusamus, cred irony biodiesel keffiyeh omukozi w'emikono ullamco ekivaamu.

@mdo

Veniam marfa ebirevu skateboard, adipisicing ekirevu kya fugiat velit ekirevu eky’ekika kya pitchfork. Freegan ekirevu aliqua cupidatat ekirevu kya mcsweeney. Cupidatat abantu bana loko nisi, ea helvetica nulla carles. Loole y'emmere ya ssweeta ya cosby eriko ttatu, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 eby’okwewunda. Carles non aesthetic okukola dduyiro quis gentrify. Brooklyn adipisicing eby'emikono bbiya vice keytar deserunt.

emu

Occaecat ekika kya commodo ekiyitibwa ekirungo ekiyitibwa occaecat. Fap ebyemikono bbiya deserunt skateboard ea. Lomo obugaali eddembe adipisicing banh mi, velit ea sunt omutendera oguddako locavore kaawa ow’ensibuko emu mu magna veniam. Obulamu obw'amaanyi id vinyl, echo park consequat quis aliquip banh mi ppipa. Vero VHS est okusiiga amasanyalaze. Consectetur nisi DIY minim ensawo y'omubaka. Cred ex mu, okuwangaala delectus consectetur fanny pack iphone.

bbiri

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 ensawo y'omubaka marfa kyonna delectus loole y'emmere. Sapiente synth id okulowooza nti. Locavore sed helvetica cliche irony, okubwatuka osanga towuliddeko consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat nga tebannaba kutunda, terry richardson proident brunch nesciunt quis cosby ssweeta pariatur keffiyeh ut helvetica omukubi w'emikono. Cardigan craft bbiya seitan nga yeetegefu velit. VHS chambray laboris ekika kya veniam eky’ekiseera. Anim mollit minim commodo ullamco okubwatuka kw'okubwatuka.


Enkozesa

Okuyita mu bikwata ku data

Okusobola okwanguyirwa okwongerako enneeyisa ya scrollspy ku topbar navigation yo, just add data-spy="scroll"ku element gyoyagala okuketta (okusinga kino kyandibadde mubiri) era data-target=".navbar"okulonda nav ki gy'okozesa. Ojja kwagala okukozesa scrollspy .navn'ekitundu.

  1. <omubiri data-spy = "okutambula" data-ekigendererwa = ".navbar" > ... </omubiri>

Okuyita mu JavaScript

Kuba essimu y’omuzingo ng’oyita mu JavaScript:

  1. $ ( '#navbar' ). scrollspy () .
Emitwe gigulumivu! Enkolagana za Navbar zirina okuba n'ebigendererwa bya id ebisobola okugonjoolwa. Okugeza, a <a href="#home">home</a>alina okukwatagana n’ekintu ekiri mu dom nga <div id="home"></div>.

Enkola

.scrollspy('okuzza obuggya')

Bw'oba okozesa scrollspy wamu n'okugattako oba okuggyawo ebintu okuva mu DOM, ojja kwetaaga okuyita enkola y'okuzza obuggya nga bwe kityo:

  1. $ ( '[data-spy="okutambula"]' ). buli ( omulimu () { .
  2. var $ omukessi = $ ( kino ). scrollspy ( 'okuzza obuggya' ) .
  3. });

Eby’okulondako

Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-, nga mu data-offset="".

Erinnya okuwandiika okukosamu okunnyonnyola
offset omuwendo 10. 10 Pixels oku offset okuva waggulu nga obala ekifo ky'omuzingo.

Ebibaddewo

Omukolo Okunnyonnyola
okukola Ekintu kino kikuba omuliro buli ekintu ekipya lwe kifuuka ekikozesebwa scrollspy.

Eby’okulabirako tabu

Okwongera ku nkola ya tabu ey’amangu, ekyukakyuka okukyuka okuyita mu bitundu by’ebirimu eby’omu kitundu, wadde ng’oyita mu menyu ezikka.

Raw denim osanga toziwuliddeko jean shorts Austin. Nesciunt tofu stumptown aliqua, okuyonja omukugu mu kukola eby’amaguzi eby’edda. Ebirevu cliche eby’ekiseera, williamsburg carles vegan helvetica. Reprehenderit omunyama retro keffiyeh omukwasi w'ebirooto synth. Ssweeta ya cosby eu banh mi, qui irure terry richardson eyali squid. Aliquip placeat omusajja omulala ayitibwa salvia cillum iphone. Seitan aliquip quis cardigan engoye z'omumerika, omunyama 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.


Enkozesa

Ssobozesa tabu eziriko tabba ng’oyita mu JavaScript (buli tabu yeetaaga okukozesebwa kinnoomu):

  1. $ ( '#Tab yange a' ). click ( omulimu ( e ) { .
  2. e . okuziyizaEkisookerwako ();
  3. $ ( kino ). tab ( 'laga' );
  4. }) .

Osobola okukola tabu ssekinnoomu mu ngeri eziwerako:

  1. $ ( '#Tab yange a[href="#profile"]' ). tab ( 'laga' ); // Londa tab okusinziira ku linnya
  2. $ ( '#Tab yange a:esooka' ). tab ( 'laga' ); // Londa ekitundu ekisooka
  3. $ ( '#Tab yange a:esembayo' ). tab ( 'laga' ); // Londa ekitundu ekisembayo
  4. $ ( '#Tab yange li:eq (2) a' ). tab ( 'laga' ); // Londa ekitundu ekyokusatu (0-indexed) .

Okuteeka obubonero

Osobola okukola tab oba pill navigation nga towandiise JavaScript yonna nga omala kulaga data-toggle="tab"oba data-toggle="pill"ku element. Okwongera navne nav-tabsclasses ku tab ulkijja kukozesa Bootstrap tab styling.

  1. <ul ekibiina = "nav nav-tabs" >
  2. <li><a href = "#awaka" data-toggle = "tabu" > Awaka </a></li>
  3. <li><a href = "#profile" data-toggle = "tabu" > Ebifaananyi </a></li>
  4. <li><a href = "#obubaka" data-toggle = "tabu" > Obubaka </a></li>
  5. <li><a href = "#ensengeka" data-toggle = "tabu" > Ensengeka </a></li>
  6. </ul>

Enkola

$().tab

Ekola ekintu kya tabu n'ekintu ekirimu. Tab erina okuba ne oba a data-targetoba an hreftargeting a container node mu DOM.

  1. <ul ekibiina = "nav nav-tabs" id = "Tab yange" >
  2. <li class = "ekola" ><a href = "#awaka" > Awaka </a></li>
  3. <li><a href = "#profile" > Ebifaananyi </a></li>
  4. <li><a href = "#obubaka" > Obubaka </a></li>
  5. <li><a href = "#ensengeka" > Ensengeka </a></li>
  6. </ul>
  7.  
  8. <div class = "ebirimu tabu" >
  9. <div class = "tabu-pane ekola" id = "awaka" > ... </div>
  10. <div kiraasi = "tabu-pane" id = "profayiro" > ... </div>
  11. <div class = "tabu-pane" id = "obubaka" > ... </div>
  12. <div class = "tab-pane" id = "ensengeka" > ... </div>
  13. </div> nga bwe kiri
  14.  
  15. <ekiwandiiko>
  16. $ ( omulimu () { .
  17. $ ( '#Tab yange a:esembayo' ). tab ( 'laga' );
  18. }) .
  19. </script>

Ebibaddewo

Omukolo Okunnyonnyola
okulaga Ekintu kino kikuba omuliro ku tab show, naye nga tab empya tennalagibwa. Kozesa event.targetne event.relatedTargetokutunuulira tabu ekola ne tabu ekola eyasooka (bwe kiba nga kiriwo) mu kulondako.
eragiddwa Ekintu kino kikuba omuliro ku tab show oluvannyuma lwa tab okulagibwa. Kozesa event.targetne event.relatedTargetokutunuulira tabu ekola ne tabu ekola eyasooka (bwe kiba nga kiriwo) mu kulondako.
  1. $ ( 'a[data-okukyusakyusa="tabu"]' ). ku ( 'alagiddwa' , omulimu ( e ) {
  2. e . target // tab ekoleddwa
  3. e . relatedTarget // ekitundu ekiyise
  4. }) .

Eby’okulabirako

Nga efunye okubudaabudibwa okuva mu nkola ennungi ennyo eya jQuery.tipsy eyawandiikibwa Jason Frame; Tooltips ye nkyusa erongooseddwa, etasinziira ku bifaananyi, ekozesa CSS3 ku animations, ne data-attributes okutereka emitwe egy'omu kitundu.

Olw'ensonga z'okukola, tooltip ne popover data-apis zibeera opt in, ekitegeeza nti olina okuzitandika ggwe kennyini .

Hover ku links wammanga olabe ebikozesebwa:

Tight pants next level keffiyeh osanga toziwuliddeko . Ekifaananyi ekibanda ekirevu embisi denim letterpress vegan omubaka ensawo stumptown. Seitan okuva ku faamu okutuuka ku mmeeza, engoye za mcsweeney eziyitibwa fixie sustainable quinoa 8-bit american apparel zirina terry richardson vinyl chambray. Ekirevu stumptown, cardigans banh mi lomo okubwatuka. Tofu biodiesel williamsburg marfa, bana loko mcsweeney's okuyonja vegan chambray. A really ironic artisan whatever keytar , scenester faamu-ku-mmeeza banksy Austin twitter okukwata freegan cred embisi denim ensibuko emu kaawa viral.

Endagiriro nnya

Ebikozesebwa mu bibinja by’okuyingiza

Nga okozesa obukodyo bw'ebikozesebwa ne popovers n'ebibinja by'okuyingiza Bootstrap, ojja kuba olina okuteekawo container(ewandiikiddwa wansi) eky'okulonda okwewala ebizibu by'otayagala.


Enkozesa

Trigger the tooltip nga oyita mu JavaScript:

  1. $ ( '#ekyokulabirako' ). tooltip ( eby'okulonda ) .

Eby’okulondako

Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-, nga mu data-animation="".

Erinnya okuwandiika okukosamu okunnyonnyola
okukola ebifaananyi ebirina obulamu boolean kituufu kozesa enkyukakyuka ya css fade ku tooltip
html boolean -kyaamu Teeka html mu tooltip. Bwe kiba kya bulimba, enkola ya jquery textejja kukozesebwa okuyingiza ebirimu mu dom. Kozesa ebiwandiiko bw'oba weeraliikirira obulumbaganyi bwa XSS.
okuteekebwa mu kifo olunyiriri | enkola 'waggulu' engeri y'okuteeka ekiwandiiko ky'ebikozesebwa - waggulu | wansi | ku kkono | kituufu
omusunsuzi akaguwa -kyaamu Singa omusunsula aweebwa, ebintu ebikozesebwa bijja kuweebwa ebigendererwa ebiragiddwa.
omutwe olunyiriri | enkola '' . omuwendo gw'omutwe ogusookerwako singa `title` tag tebaawo
okusiikula akaguwa 'okussa essira ku 'hover'. engeri tooltip gy'etandikibwamu - nyweza | hover | okussa essira | maniyo. Weetegereze gwe case pass trigger mutliple, ekifo kyawuddwamu, ebika bya trigger.
okulwawo ennamba | ekintu 0.

okulwawo okulaga n'okukweka tooltip (ms) - tekwata ku kika kya manual trigger

Singa ennamba eweebwa, okulwawo kukozesebwa ku byombi okukweka/okulaga

Ensengeka y’ekintu eri nti:delay: { show: 500, hide: 100 }

ekintu ekirimu ebintu olunyiriri | -kyaamu -kyaamu

Egattako ekintu ekikozesebwa ku kintu ekigerecontainer: 'body'

Emitwe gigulumivu! Enkola z’ebikozesebwa ssekinnoomu zisobola okulagibwa mu ngeri endala okuyita mu kukozesa ebikwata ku data.

Okuteeka obubonero

  1. <a href = "#" data-toggle = "ekikozesebwa" title = "ekikozesebwa ekisooka" > hover over me </a>

Enkola

$().ekikozesebwa(ebyokulonda) .

Egattako omukwasi w'ebikozesebwa ku kukungaanya elementi.

.tooltip('laga') .

Abikkula ekiwandiiko ky'ekintu ekiyitibwa tooltip.

  1. $ ( '#ekintu' ). tooltip ( 'laga' ) .

.tooltip('okukweka') .

Ekweka ekiwandiiko ky'ekintu ekiyitibwa tooltip.

  1. $ ( '#ekintu' ). tooltip ( 'kwekweka' ) .

.tooltip('okukyusa')

Ekyusakyusa ekintu ekiyitibwa tooltip.

  1. $ ( '#ekintu' ). tooltip ( 'okukyusa' ) .

.tooltip('okusaanyaawo')

Ekweka n'okusaanyaawo ekintu ekiyitibwa tooltip.

  1. $ ( '#ekintu' ). tooltip ( 'okusaanyaawo' ) .

Eby’okulabirako

Okwongerako obutonotono obubikkiddwako ebirimu, ng’ebyo ebiri ku iPad, ku kintu kyonna eky’okuteeka amawulire ag’okubiri. Hover ku button okutandika popover. Yeetaaga Tooltip okuteekebwamu.

Static popover nga bwe kiri

Enkola nnya ziriwo: waggulu, ku ddyo, wansi, ne kkono nga zikwatagana.

Popover waggulu

Sed posuere consectetur esangibwa mu kifo ekiyitibwa lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia ekisenge ky’omu lubuto ekiyitibwa vestibulum.

Popover kituufu

Sed posuere consectetur esangibwa mu kifo ekiyitibwa lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia ekisenge ky’omu lubuto ekiyitibwa vestibulum.

Popover wansi

Sed posuere consectetur esangibwa mu kifo ekiyitibwa lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia ekisenge ky’omu lubuto ekiyitibwa vestibulum.

Popover yavuddeyo

Sed posuere consectetur esangibwa mu kifo ekiyitibwa lobortis. Aenean eu leo ​​quam. Pellentesque ornare sem lacinia ekisenge ky’omu lubuto ekiyitibwa vestibulum.

Tewali markup eragiddwa nga popovers zikolebwa okuva mu JavaScript n'ebirimu munda mu dataattribute.

Live demo

Endagiriro nnya


Enkozesa

Ssobozesa popovers nga oyita mu JavaScript:

  1. $ ( '#ekyokulabirako' ). popover ( eby'okulondako ) .

Eby’okulondako

Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-, nga mu data-animation="".

Erinnya okuwandiika okukosamu okunnyonnyola
okukola ebifaananyi ebirina obulamu boolean kituufu kozesa enkyukakyuka ya css fade ku tooltip
html boolean -kyaamu Teeka html mu popover. Bwe kiba kya bulimba, enkola ya jquery textejja kukozesebwa okuyingiza ebirimu mu dom. Kozesa ebiwandiiko bw'oba weeraliikirira obulumbaganyi bwa XSS.
okuteekebwa mu kifo olunyiriri | enkola 'kituufu' engeri y'okuteeka popover - waggulu | wansi | ku kkono | kituufu
omusunsuzi akaguwa -kyaamu singa omusunsu aweebwa, ebintu ebikozesebwa bijja kuweebwa ebigendererwa ebiragiddwa
okusiikula akaguwa 'nyiga'. engeri popover gy'etandika - nyweza | hover | okussa essira | maniyo
omutwe olunyiriri | enkola '' . omuwendo gw'omutwe ogusookerwako singa ekintu `title` tekibaawo
okwesiima olunyiriri | enkola '' . omuwendo gw'ebirimu ogusookerwako singa ekintu kya `data-content` tekibaawo
okulwawo ennamba | ekintu 0.

okulwawo okulaga n'okukweka popover (ms) - tekukwata ku kika kya manual trigger

Singa ennamba eweebwa, okulwawo kukozesebwa ku byombi okukweka/okulaga

Ensengeka y’ekintu eri nti:delay: { show: 500, hide: 100 }

ekintu ekirimu ebintu olunyiriri | -kyaamu -kyaamu

Agattako popover ku elementi eyeetongoddecontainer: 'body'

Emitwe gigulumivu! Enkola za popovers ssekinnoomu zisobola mu ngeri endala okulagibwa okuyita mu kukozesa data attributes.

Okuteeka obubonero

Olw'ensonga z'okukola, Tooltip ne Popover data-apis zibeera opt in. Bw'oba oyagala okuzikozesa just specify a selector option.

Enkola

$().popover(ebyokulonda) .

Etandikawo popovers olw'okukung'aanya elementi.

.popover('laga') .

Abikkula ekintu ekiyitibwa elements popover.

  1. $ ( '#ekintu' ). popover ( 'okulaga' ) .

.popover('kwekweka') .

Akweka ekintu ekiyitibwa elements popover.

  1. $ ( '#ekintu' ). popover ( 'kwekweka' ) .

.popover('okukyusakyusa')

Ekyusakyusa ekintu ekiyitibwa elements popover.

  1. $ ( '#ekintu' ). popover ( 'okukyusakyusa' ) .

.popover('okusaanyaawo')

Akweka era asaanyaawo popover ya elementi.

  1. $ ( '#ekintu' ). popover ( 'okusaanyaawo' ) .

Eky’okulabirako okulabula

Okwongerako enkola y'okugoba ku bubaka bwonna obw'okulabula ne plugin eno.

Guacamole omutukuvu! Best check yo self, tolabika bulungi nnyo.

Oh snap! Ofunye ensobi!

Kyusa kino ne kiri oddemu ogezeeko. Duis mollis, est non commodo luctus, nisi erat ekika ky’omugongo, eget lacinia odio sem nec elit. Cras mattis consectetur purus etuula mu kizimbulukusa.

Kola ekikolwa kino Oba kino kikole


Enkozesa

Ssobozesa okugoba okulabula ng'oyita mu JavaScript:

  1. $ ( ".okulabula" ). okulabula () .

Okuteeka obubonero

Just add data-dismiss="alert"ku close button yo okuwa automatically okuwa alert close functionality.

  1. <a class = "okuggalawo" data-dismiss = "okulabula" href = "#" > &emirundi; </a>

Enkola

$().okulabula () .

Azinga okulabula kwonna n'emirimu egy'okumpi. Okusobola okuba n’okulabula kwo animate out nga kuggaddwa, kakasa nti balina the .fadeand .inclass eyakozesebwa dda ku zo.

.alert('okuggalawo')

Aggalawo okulabula.

  1. $ ( ".okulabula" ). alert ( 'okuggalawo' ) .

Ebibaddewo

Bootstrap's alert class eraga ebitonotono ebibaawo olw'okuyunga mu nkola y'okulabula.

Omukolo Okunnyonnyola
okuggalawo Ekintu kino kikuba amangu ddala nga closeenkola ya instance eyitiddwa.
eggaddwawo Ekintu kino kikubwa nga okulabula kuggaddwa (kijja kulinda enkyukakyuka za css okuggwa).
  1. $ ( '#okulabula kwange' ). bind ( 'kiggaddwa' , omulimu () { .
  2. // kola ekintu...
  3. }) .

Eby’okulabirako by’okukozesa

Kola ebisingawo ne buttons. Control button states oba tonda ebibinja bya buttons ku bitundu ebisingawo nga toolbars.

Stateful

Okwongerako data-loading-text="Loading..."okukozesa embeera y'okutikka ku bbaatuuni.

  1. < ekika kya button = "button" class = "btn btn-primary" data-loading-text = "Etikka..." > Embeera y'okutikka </button>

Okukyusakyusa okumu

Okwongerako data-toggle="button"okukola toggling ku button emu.

  1. < ekika kya button = "button" class = "btn btn-primary" data-toggle = "bbaatuuni" > Okukyusa okumu </button>

Akabokisi akalaga

Okwongerako data-toggle="buttons-checkbox"ku checkbox style toggling ku btn-group.

  1. <div class = "btn-ekibinja" data-toggle = "akabokisi-okukebera obutambi" >
  2. < ekika kya button = "button" ekibiina = "btn btn-primary" > Kkono </button>
  3. < ekika kya button = "button" class = "btn btn-primary" > Wakati </button>
  4. < ekika kya button = "button" ekibiina = "btn btn-primary" > Ku ddyo </button>
  5. </div> nga bwe kiri

Leediyo

Okwongerako data-toggle="buttons-radio"ku kukyusakyusa sitayiro ya leediyo ku btn-group.

  1. <div class = "btn-ekibinja" data-okukyusa = "obutambi-leediyo" >
  2. < ekika kya button = "button" ekibiina = "btn btn-primary" > Kkono </button>
  3. < ekika kya button = "button" class = "btn btn-primary" > Wakati </button>
  4. < ekika kya button = "button" ekibiina = "btn btn-primary" > Ku ddyo </button>
  5. </div> nga bwe kiri

Enkozesa

Ssobozesa obutambi ng'oyita mu JavaScript:

  1. $ ( '.nav-ebipande' ). bbaatuuni () .

Okuteeka obubonero

Ebikwata ku data bikulu nnyo mu plugin ya button. Laba ekyokulabirako kya koodi wansi ku bika by’obubonero obw’enjawulo.

Eby’okulondako

Tewali

Enkola

$ ().button ('okukyusa')

Ekyusakyusa embeera y'okusika. Awa button endabika nti ebadde ekozeseddwa.

Emitwe gigulumivu! Osobola okusobozesa auto toggling ya button nga okozesa data-toggleattribute.
  1. < ekika kya button = "button" ekibiina = "btn" data-toggle = "button" > ... </button>

$().button ('okutikka') .

Eteeka embeera ya button ku kutikka - eremesa button era ewanyisiganya ebiwandiiko okudda ku kutikka ebiwandiiko. Okutikka ebiwandiiko kulina okunnyonnyolwa ku elementi ya button nga okozesa data attribute data-loading-text.

  1. <button type = "button" class = "btn" data-okutikka-ekiwandiiko = "okutikka ebintu..." > ... </button>
Emitwe gigulumivu! Firefox enyweza embeera eremeddwa okuyita mu kutikka empapula zonna . Eky'okugonjoola kino kwe kukozesa autocomplete="off".

$ ().button ('okuddamu okuteekawo')

Ezzaawo embeera ya button - ekyusa ebiwandiiko okudda mu biwandiiko eby'olubereberye.

$().button(olunyiriri) .

Ezzaawo embeera ya button - ewanyisiganya ebiwandiiko ku mbeera yonna eya data etegeezeddwa embeera y'ekiwandiiko.

  1. < ekika kya button = "button" class = "btn" data-ekiwandiiko-ekijjuvu = "kiwedde!" > ... </button> nga bwe kiri
  2. <ekiwandiiko>
  3. $ ( '.btn' ). button ( 'okumaliriza' ) .
  4. </script>

Ku

Funa emisono egy’omusingi n’obuwagizi obukyukakyuka obw’ebitundu ebiyinza okugwa nga accordions ne navigation.

* Yeetaaga plugin ya Transitions okuteekebwamu.

Okugeza accordion

Nga tukozesa collapse plugin, twazimba widget ennyangu ey’omulembe gwa accordion:

Anim pariatur cliche reprehenderit, enim eiusmod obulamu obw'ekika ekya waggulu accusamus terry richardson ad squid. 3 omusege omwezi officia aute, etali ya cupidatat skateboard dolor brunch. Loole y’emmere quinoa nesciunt laborum eiusmod. Brunch 3 omusege omwezi tempor, sunt aliqua okugiteekako ekinyonyi squid kaawa ow’ensibuko emu nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, bbiya ow’emikono omulimu wes anderson cred nesciunt sapiente ea proident. Ad vegan okujjako ennyama vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt osanga towuliddeko ku bo accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod obulamu obw'ekika ekya waggulu accusamus terry richardson ad squid. 3 omusege omwezi officia aute, etali ya cupidatat skateboard dolor brunch. Loole y’emmere quinoa nesciunt laborum eiusmod. Brunch 3 omusege omwezi tempor, sunt aliqua okugiteekako ekinyonyi squid kaawa ow’ensibuko emu nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, bbiya ow’emikono omulimu wes anderson cred nesciunt sapiente ea proident. Ad vegan okujjako ennyama vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt osanga towuliddeko ku bo accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod obulamu obw'ekika ekya waggulu accusamus terry richardson ad squid. 3 omusege omwezi officia aute, etali ya cupidatat skateboard dolor brunch. Loole y’emmere quinoa nesciunt laborum eiusmod. Brunch 3 omusege omwezi tempor, sunt aliqua okugiteekako ekinyonyi squid kaawa ow’ensibuko emu nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, bbiya ow’emikono omulimu wes anderson cred nesciunt sapiente ea proident. Ad vegan okujjako ennyama vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt osanga towuliddeko ku bo accusamus labore sustainable VHS.
  1. <div class = "accordion" id = "akakoodi2" >
  2. <div class = "ekibinja-eky'akakodiyo" >
  3. <div class = "omutwe gwa accordion" >
  4. <a class = "accordion-okukyusakyusa" data-toggle = "okugwa" data-omuzadde = "#accordion2" href = "#okugwaOmu" >
  5. Ekintu ky'ekibinja ekiyinza okugwa #1
  6. </a>
  7. </div> nga bwe kiri
  8. <div id = "collapseOne" class = "okugwa-omubiri-okugwa mu" >
  9. <div class = "akakoodi-omunda" >
  10. Anim pariatur ekintu ekitali kya bulijjo...
  11. </div> nga bwe kiri
  12. </div> nga bwe kiri
  13. </div> nga bwe kiri
  14. <div class = "ekibinja-eky'akakodiyo" >
  15. <div class = "omutwe gwa accordion" >
  16. <a class = "accordion-toggle" data-toggle = "okugwa" data-omuzadde = "#accordion2" href = "#okugwa Ebibiri" >
  17. Ekintu ky'ekibinja ekiyinza okugwa #2
  18. </a>
  19. </div> nga bwe kiri
  20. <div id = "okugwaBbiri" class = "okugwa-omubiri-akakoodi" >
  21. <div class = "akakoodi-omunda" >
  22. Anim pariatur ekintu ekitali kya bulijjo...
  23. </div> nga bwe kiri
  24. </div> nga bwe kiri
  25. </div> nga bwe kiri
  26. </div> nga bwe kiri
  27. ...

Osobola n’okukozesa plugin nga tolina kabonero ka accordion. Kola button toggle okugaziya n'okugwa kwa elementi endala.

  1. < ekika kya button = "button" ekibiina = "btn btn-akabi" data-toggle = "okugwa" data-ekigendererwa = "#demo" >
  2. simple eyinza okugwa
  3. </button>
  4.  
  5. <div id = "demo" class = "okugwa mu" > ... </div>

Enkozesa

Okuyita mu bikwata ku data

Just add data-toggle="collapse"ne a data-targetku element okugaba automatically control ya element eyinza okugwa. Ekintu data-targetkikkiriza css selector okukozesa okugwa. Kakasa nti ogattako kiraasi collapseku elementi eyinza okugwa. Bw'oba oyagala kiggule nga kisookerwako, yongera ku kiraasi ey'okugattako in.

Okwongera okuddukanya ekibinja ekiringa accordion ku control eyinza okugwa, yongera ku data attribute data-parent="#selector". Laba demo olabe kino mu bikolwa.

Okuyita mu JavaScript

Ssobozesa mu ngalo ne:

  1. $ ( ".okugwa" ). okugwa () .

Eby’okulondako

Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-, nga mu data-parent="".

Erinnya okuwandiika okukosamu okunnyonnyola
omuzadde omusunsuzi -kyaamu Singa selector awo ebintu byonna ebiyinza okugwa wansi w'omuzadde alagiddwa bijja kuggalwawo nga ekintu kino ekiyinza okugwa kiragiddwa. (okufaananako n’enneeyisa ya accordion ey’ekinnansi)
okukyusakyusa boolean kituufu Ekyusa ekintu ekiyinza okugwa ku kuyita

Enkola

.okugwa(ebyokulonda) .

Ekola ebirimu byo nga ekintu ekiyinza okugwa. Akkiriza eby'okulonda eby'okwesalirawo object.

  1. $ ( '#kiyinza okugwa' ). okugwa ({
  2. toggle : eky'obulimba
  3. }) .

.collapse('okukyusa')

Ekyusa ekintu ekiyinza okugwa okukiragibwa oba okukwekebwa.

.collapse('laga') .

Alaga ekintu ekiyinza okugwa.

.collapse('kwekweka') .

Ekweka ekintu ekiyinza okugwa.

Ebibaddewo

Bootstrap's collapse class eraga ebitonotono ebibaawo olw'oku hooking mu collapse functionality.

Omukolo Okunnyonnyola
okulaga Ekintu kino kikuba amangu ddala nga showenkola ya instance eyitiddwa.
eragiddwa Ekintu kino kikubwa nga ekintu ekigwa kikoleddwa okulabika eri omukozesa (kijja kulinda enkyukakyuka za css okuggwa).
okweekweeka Ekintu kino kikubwa amangu ddala hideng’enkola eyitiddwa.
okukweekebwa Ekintu kino kikubwa nga ekintu ekigwa kikwekeddwa okuva eri omukozesa (kijja kulinda enkyukakyuka za css okuggwa).
  1. $ ( '#kiyinza okugwa' ). ku ( 'ekikwekeddwa' , omulimu () { .
  2. // kola ekintu...
  3. }) .

Eky'okulabirako

Plugin enkulu, eyangu okugaziwa ey'okukola amangu typeaheads ennungi n'okuyingiza ebiwandiiko bya ffoomu yonna.

  1. < ekika ky'okuyingiza = "ekiwandiiko" data-provide = "ekika mu maaso" >

Ojja kwagala okuteekawo autocomplete="off"okuziyiza menu za browser ezisookerwako okulabika ku Bootstrap typeahead dropdown.


Enkozesa

Okuyita mu bikwata ku data

Okwongerako data attributes okuwandiisa elementi erimu typeahead functionality nga bwekiragibwa mu kyokulabirako waggulu.

Okuyita mu JavaScript

Kuba typeahead mu ngalo nga okozesa:

  1. $ ( '.okuwandiika mu maaso' ). okuwandiika mu maaso () .

Eby’okulondako

Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-, nga mu data-source="".

Erinnya okuwandiika okukosamu okunnyonnyola
ensibuko ensengekera, omulimu [ ] . Ensibuko ya data okubuuza ku. Ayinza okuba ensengeka y'ennyiriri oba omulimu. Omulimu guyisibwa ensonga bbiri, queryomuwendo mu kifo ky’okuyingiza n’okuddamu processokuyita. Omulimu guyinza okukozesebwa mu ngeri ey’okukwatagana nga guzzaayo ensibuko ya data butereevu oba mu ngeri etakwatagana nga oyita mu processnsonga emu ey’okuddamu okuyita.
ebintu omuwendo 8. Omuwendo ogusinga obunene ogw'ebintu eby'okulaga mu dropdown.
minObuwanvu omuwendo 1. Obuwanvu bw'ennukuta obutono obwetaagisa nga tonnatandika biteeso bya autocomplete
omuzannyi w’omupiira enkola obutafaayo ku nnyiriri ennene Enkola ekozesebwa okuzuula oba ekibuuzo kikwatagana n’ekintu. Akkiriza ensonga emu, itemegenda okugezesa okubuuza. Funa ekibuuzo ekiriwo kati ne this.query. Ddamu boolean truesinga okubuuza kuba kukwatagana.
omusunsula enkola okukwatagana okutuufu,
okukwata ku nnyiriri ennene, obutakwata ku
nnyiriri ennene
Enkola ekozesebwa okusunsula ebivudde mu autocomplete. Ekkiriza ensonga emu itemsera erina obuwanvu bw'ekyokulabirako kya typeahead. Jjukira ekibuuzo ekiriwo kati ne this.query.
omulongoosa enkola azzaayo ekintu ekirondeddwa Enkola ekozesebwa okuzzaayo ekintu ekirondeddwa. Akkiriza ensonga emu, itemera erina obuwanvu bw'ekyokulabirako kya typeahead.
ekintu ekiraga ebifaananyi enkola eraga ebikwatagana byonna ebisookerwako Enkola ekozesebwa okulaga ebivudde mu autocomplete. Ekkiriza ensonga emu itemera erina obuwanvu bw'ekyokulabirako kya typeahead. Alina okuzzaayo html.

Enkola

.typeahead(ebyokulonda) .

Etandikawo ekiyingizibwa nga kiriko typeahead.

Eky'okulabirako

Subnavigation ku kkono ye live demo ya affix plugin.


Enkozesa

Okuyita mu bikwata ku data

Okusobola okwanguyirwa okwongera ku nneeyisa y’okugatta ku elementi yonna, yongera data-spy="affix"ku elementi gy’oyagala okuketta. Oluvannyuma kozesa offsets okunnyonnyola ddi lw’olina okukyusakyusa okusiba ekintu okutandika n’okuggyako.

  1. <div data-spy = "okussaako" data-offset-oku ntikko = "200" > ... </div>
Emitwe gigulumivu! Olina okuddukanya ekifo ky’ekintu ekissiddwako ppini n’enneeyisa y’omuzadde waakyo ow’okumpi. Ekifo kifugibwa affix, affix-top, ne affix-bottom. Jjukira okukebera omuzadde ayinza okugwa nga affix eyingiddewo kuba eggyawo ebirimu okuva mu ntambula eya bulijjo ey'olupapula.

Okuyita mu JavaScript

Kuba ku affix plugin ng'oyita mu JavaScript:

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

Eby’okulondako

Ebyokulonda bisobola okuyisibwa nga biyita mu data attributes oba JavaScript. Ku bikwata ku data, ssaako erinnya ly'okulonda ku data-, nga mu data-offset-top="200".

Erinnya okuwandiika okukosamu okunnyonnyola
offset ennamba | omulimu | ekintu 10. 10 Pixels oku offset okuva ku screen nga obala ekifo ky'omuzingo. Singa ennamba emu eweebwa, offset ejja kukozesebwa mu ndagiriro zombi eza waggulu ne kkono. Okuwuliriza obulagirizi bumu, oba offsets ez'enjawulo eziwera, just give an object offset: { x: 10 }. Kozesa omulimu nga weetaaga okuwa offset mu ngeri ey’amaanyi (eky’omugaso ku dizayini ezimu eziddamu).