Iingcebiso
Amaxwebhu kunye nemizekelo yokongeza iingcebiso zesiko le-Bootstrap ngeCSS kunye neJavaScript usebenzisa i-CSS3 yoopopayi kunye neempawu zedatha zogcino lwesihloko sendawo.
Izinto omawuzazi xa usebenzisa iplagi yesixhobo se-tooltip:
- Iingcebiso zezixhobo zixhomekeke kwithala leencwadi le-3rd Popper.js ngokubekwa . Kufuneka ubandakanye i -popper.min.js phambi kwe-bootstrap.js okanye usebenzise
bootstrap.bundle.min.js
/bootstrap.bundle.js
equlethe i-Popper.js ukuze izixhobo zokusebenza zisebenze! - Ukuba wakha iJavaScript yethu kwimvelaphi, kufuna
util.js
. - Iingcebiso zezixhobo zingenile ngenxa yezizathu zokusebenza, ke kufuneka uziqalise ngokwakho .
- Iingcebiso zezixhobo ezinezihloko ezibude buziro aziboniswa.
- Cacisa
container: 'body'
ukunqanda unikezelo lweengxaki kumacandelo antsokothileyo (njengamaqela ethu egalelo, amaqela amaqhosha, njl.njl). - Iingcebiso zokuqalisa kwizinto ezifihlakeleyo aziyi kusebenza.
- Iingcebiso zesixhobo
.disabled
okanyedisabled
izakhi kufuneka zivuswe kuphawu lokusonga. - Xa iqaliswa ukusuka kwiihyperlink ezithatha imigca emininzi, iincam zesixhobo ziya kugxilwa. Sebenzisa
white-space: nowrap;
kwi yakho<a>
ukunqanda le ukuziphatha. - Iingcebiso kufuneka zifihlwe phambi kokuba izinto ezihambelanayo nazo zisuswe kwiDOM.
Unayo yonke loo nto? Kulungile, makhe sibone ukuba basebenza njani ngemizekelo ethile.
Enye indlela yokuqalisa zonke iingcebiso zesixhobo kwiphepha inokuba kukukhetha ngophawu lwazo data-toggle
:
Hambisa ngaphezulu kwezi linki zingezantsi ukuze ubone iingcebiso zesixhobo:
Iibhulukhwe eziqinileyo kwinqanaba elilandelayo keffiyeh mhlawumbi awuzange uve ngazo. Photo booth iindevu ekrwada idenim letterpress vegan messenger bag stumptown. Ifama-to-itheyibhile seitan, i-mcsweeney's fixie ezinzileyo iquinoa ye-8-bit yaseMelika isambatho sine - terry richardson vinyl chambray. Iindevu stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. Igcisa elihlekisayo ngokwenene whatever keytar , i-scenar farm-to-table banksy Austin twitter handle freegan cred krwada idenim enye-origin ikofu viral.
Hambisa phezu kwamaqhosha angezantsi ukuze ubone izalathiso zezixhobo ezine: phezulu, ekunene, ezantsi, nasekhohlo.
Kwaye nge-HTML yesiko elongeziweyo:
Isixhobo se-plugin se-tooltip sivelisa umxholo kunye ne-markup kwimfuno, kwaye ngokungagqibekanga iindawo zeengcebiso zesixhobo emva kwento yazo ye-trigger.
Qalisa ingcebiso yesixhobo ngeJavaScript:
Ukuphuphuma auto
kwayescroll
Indawo yengcebiso yesixhobo izama ukuzitshintsha ngokuzenzekelayo xa isikhongozeli somzali sinaso overflow: auto
okanye overflow: scroll
sisithanda .table-responsive
, kodwa sigcina indawo ebekuyo yokuqala. Ukusombulula, seta boundary
ukhetho kuyo nayiphi na enye into ngaphandle kwexabiso elingagqibekanga, 'scrollParent'
elinje 'window'
:
Uphawu olufunekayo lwencam yesixhobo luphawu kuphela data
kwaye title
kwisiqalelo se-HTML unqwenela ukuba nencam yesixhobo. Uphawu oluveliswayo lwencam yesixhobo lulula, nangona lufuna indawo (ngokungagqibekanga, top
lumiselwe yiplagi).
Ukwenza iingcebiso zesixhobo zisebenzele ikhibhodi kunye nabasebenzisi betekhnoloji abancedisayo
Kufuneka wongeze kuphela iingcebiso zesixhobo kwizinto ze-HTML ngokwesiko zekhibhodi-ejolise kwaye isebenze (ezifana namakhonkco okanye ulawulo lwefom). Nangona izinto ze-HTML ezingenamkhethe (ezinje <span>
s) zinokwenziwa ziqwalaselwe ngokongeza tabindex="0"
uphawu, oku kuyakongeza ukumisa okunokucaphukisa kunye nokubhidanisa ithebhu kwizinto ezingasebenzisaniyo kubasebenzisi bebhodi yezitshixo. Ukongeza, uninzi lweetekhnoloji ezincedisayo okwangoku azibhengezi inqaku lesixhobo kule meko.
Ukongeza, ungathembeli kuphela hover
njengesixhobo sesixhobo sakho, njengoko oku kuya kwenza ukuba izixhobo zakho zesixhobo zingenzeki ukuqalisa kubasebenzisi bebhodi yezitshixo.
Izinto disabled
ezinophawu azisebenzi, nto leyo ethetha ukuba abasebenzisi abanakugxila, bashukume, okanye bacofe ukuze baqalise ingcebiso yesixhobo (okanye ipopover). Njengendlela yokusebenza, uya kufuna ukuvusa inqaku lesixhobo ukusuka kwisisongelo <div>
okanye <span>
, eyenziwe ngokufanelekileyo ikhibhodi-ijolise ekusebenziseni tabindex="0"
, kwaye ubhale ngaphezulu pointer-events
kwinto ekhubazekileyo.
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-animation=""
.
Igama | Uhlobo | Ukuhlala kukho | Inkcazo |
---|---|---|---|
oopopayi | boolean | yinyani | Faka inguqu ye-CSS fade kwi-tooltip |
isikhongozeli | umtya | into | bubuxoki | bubuxoki | Ihlomela incam yesixhobo kwinto ethile. Umzekelo: |
ukulibazisa | inombolo | into | 0 | Ukulibazisa ukubonisa kunye nokufihla isixhobo sesixhobo (ms) - akusebenzi kuhlobo lwesixhobo sokuxhobisa Ukuba inani linikiwe, ukulibaziseka kufakwa kuzo zombini ezifihla/umboniso Ulwakhiwo lwento yile: |
html | boolean | bubuxoki | Vumela i-HTML kwincam yesixhobo. Ukuba yinyaniso, iithegi ze-HTML kwincam yesixhobo Sebenzisa umbhalo ukuba unexhala malunga nohlaselo lwe-XSS. |
ukubekwa | umtya | umsebenzi | 'phezulu' | Uyibeka njani incam yesixhobo - auto | phezulu | emazantsi | ekhohlo | kunene. Xa umsebenzi usetyenziswa ukumisela ukubekwa, ubizwa ngokuba nencam yesixhobo ye-DOM njengengxoxo yayo yokuqala kunye nesiqalo se-DOM node njengesibini sayo. Umxholo |
umkhethi | umtya | bubuxoki | bubuxoki | Ukuba umkhethi unikiwe, izixhobo zesixhobo ziya kunikezelwa kwiithagethi ezichaziweyo. Ngokwesiqhelo, oku kusetyenziselwa ukwenza umxholo weHTML oguquguqukayo ube neepopovers zongezwe. Bona oku kunye nomzekelo ofundisayo . |
ithempleyithi | umtya | '<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>' |
Isiseko se-HTML esiza kusetyenziswa xa usenza ithiphu yesixhobo. Isixhobo se-tooltip
Isiqalelo sokusonga sangaphandle kufuneka sibe |
isihloko | umtya | into | umsebenzi | '' | Ixabiso lesihloko esihlala sihleli ukuba Ukuba umsebenzi unikiwe, uya kubizwa kunye |
ukuxhokonxa | umtya | 'hover focus' | Ivuswa njani ithiphu yesixhobo - cofa | jonga | gxila | incwadi yesandla. Ungadlula ezininzi izichukumisi; bahlule ngesithuba.
|
i-offset | inombolo | umtya | 0 | Iseti yesixhobo esinxulumene noko kujoliswe kuko. Ngolwazi oluthe kratya jonga kwi-Popper.js's offset docs . |
i-fallbackPlacement | umtya | uluhlu | 'jika' | Vumela ukuxela ukuba yeyiphi indawo iPopper eza kusebenzisa xa ubuya umva. Ngolwazi oluthe vetshe bhekisa kuPopper.js's behaviour docs |
umda | umtya | isiqalelo | 'skrolaMzali' | Ukuphuphuma komda womda wesixhobo. Yamkela amaxabiso e- 'viewport' , 'window' , 'scrollParent' , okanye i-HTMLElement ireferensi (iJavaScript kuphela). Ngolwazi oluthe vetshe bhekisa kuPopper.js's preventOverflow docs . |
Iimpawu zedatha kwiingcebiso zesixhobo ngasinye
Iinketho zeengcebiso zesixhobo ngasinye zinokuchazwa ngokusetyenziswa kweempawu zedatha, njengoko kucacisiwe ngasentla.
Iindlela ze-Asynchronous kunye notshintsho
Zonke iindlela ze-API zi -asynchronous kwaye ziqala utshintsho . Babuyela kumnxeba ngokukhawuleza nje ukuba utshintsho luqalisiwe kodwa ngaphambi kokuba luphele . Ukongeza, ukufowunelwa kwendlela kwicandelo lenguquko kuya kuhoywa .
Iqhoboshela isibambi sesixhobo kwingqokelela yesiqalelo.
Ityhila inqaku lesixhobo. Ibuyisela kumnxebi phambi kokuba incam yesixhobo iboniswe (okt phambi kokuba shown.bs.tooltip
isiganeko senzeke). Oku kuthathwa ngokuba "yimanyuwali" yokuqalisa inqaku lesixhobo. Iingcebiso zezixhobo ezinezihloko ezibude buziro aziboniswa.
Ifihla incam yesixhobo. Ibuyisela kumnxeba phambi kokuba incam yesixhobo ifihliwe (okt phambi kokuba hidden.bs.tooltip
isiganeko senzeke). Oku kuthathwa ngokuba "yimanyuwali" yokuqalisa inqaku lesixhobo.
Itshintshela incam yesixhobo. Ibuyisela kumnxebi phambi kokuba incam yesixhobo iboniswe okanye ifihlwe (okt phambi kokuba isiganeko shown.bs.tooltip
okanye hidden.bs.tooltip
isiganeko senzeke). Oku kuthathwa ngokuba "yimanyuwali" yokuqalisa inqaku lesixhobo.
Ifihla kwaye itshabalalise isixhobo sesixhobo. Iingcebiso zesixhobo ezisebenzisa unikezelo (ezenziwe ngokusetyenziswa kokhethoselector
) azinakutshatyalaliswa zizodwa kwizinto ezibangela ukuvela .
Inika isixhobo sesixhobo sokukwazi ukuboniswa. Iingcebiso zesixhobo zenziwe ngokwendalo.
Isusa isakhono sesixhobo sesixhobo sokuboniswa. Ingcebiso yesixhobo iya kuboniswa kuphela ukuba yenziwe yasebenza kwakhona.
Iguqula isakhono sesixhobo sesixhobo sokuboniswa okanye ukufihlwa.
Ihlaziya indawo yesixhobo sesixhobo.
Uhlobo loMnyhadala | Inkcazo |
---|---|
bonisa.bs.ingcebiso yesixhobo | Esi siganeko sivutha ngokukhawuleza xa show kubizwa indlela yomzekelo. |
ingcebiso.bs.isixhobo | Esi siganeko sigxothwa xa i-tooltip yenziwe yabonakala kumsebenzisi (iya kulinda iinguqu zeCSS ukuba zigqibe). |
fihla.bs.ingcebiso yesixhobo | Esi siganeko sigxothwa ngokukhawuleza xa hide indlela yomzekelo ibiziwe. |
ingcebiso.bs.isixhobo esifihliweyo | Esi siganeko siyagxothwa xa icebo lesixhobo ligqityiwe ukufihlwa kumsebenzisi (liya kulinda uguqulo lweCSS lugqibe). |
ingcebiso.bs.isixhobo | Esi siganeko sigxothwa emva show.bs.tooltip kwesiganeko xa ithemplate ye-tooltip yongezwa kwi-DOM. |