Iipopovers
Amaxwebhu kunye nemizekelo yokongezwa kweBootstrap poppovers, njengaleyo ifumaneka kwi-iOS, kuyo nayiphi na into ekwisiza sakho.
Izinto omawuzazi xa usebenzisa iplagi yepopover:
- Abantu abadumileyo baxhomekeke kwithala leencwadi le-3rd Popper.js ngokubekwa . Kufuneka uquke i -popper.min.js phambi kwe-bootstrap.js okanye usebenzise
bootstrap.bundle.min.js
/bootstrap.bundle.js
equlethe i-Popper.js ukuze i-popovers isebenze! - IiPopovers zifuna iplagi yesixhobo njengesixhobo sokuxhomekeka.
- Ukuba wakha iJavaScript yethu kwimvelaphi, kufuna
util.js
. - IiPopovers zingenile ngenxa yezizathu zokusebenza, ke kufuneka uziqalise ngokwakho .
- Ubude obuziro
title
kunyecontent
namaxabiso asoze abonise ipopover. - Cacisa
container: 'body'
ukunqanda unikezelo lweengxaki kumacandelo antsokothileyo (njengamaqela ethu egalelo, amaqela amaqhosha, njl.njl). - Ukuxhokonxa iipopovers kwizinto ezifihlakeleyo aziyi kusebenza.
- Iipopovers ze
.disabled
okanye ielementi kufuneka zivuswe kwinto esongelwayodisabled
. - Xa isenziwa ukusuka kwii-ankile ezisonga kwimigca emininzi, iipopovers ziya kugxininiswa phakathi kobubanzi beankile ngokubanzi. Sebenzisa
white-space: nowrap;
kwi yakho<a>
ukunqanda le ukuziphatha. - Iipopovers mazifihlwe phambi kokuba izinto ezihambelanayo zisuswe kwiDOM.
Qhubeka ufunda ukuze ubone indlela iipopovers ezisebenza ngayo neminye imizekelo.
Enye indlela yokuqalisa zonke iipopovers kwiphepha inokuba kukukhetha ngophawu lwazo data-toggle
:
Xa unezinye izimbo kwinto yomzali ephazamisana ne-popover, uya kufuna ukukhankanya isiko container
ukuze i-HTML ye-popover ivele ngaphakathi kweso siqalelo endaweni yoko.
<button type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
Zine iinketho ezikhoyo: phezulu, ekunene, ezantsi, nasekhohlo zilungelelanisiwe.
Sebenzisa i- focus
trigger ukugxotha iipopovers kunqakrazo olulandelayo lomsebenzisi lwento eyahlukileyo kunento yokuguqula.
Uphawulo oluthile luyafuneka ukuze ugxothe-ngokucofa-okulandelayo
Kwibrowser echanekileyo kunye nokuziphatha kweqonga, kufuneka usebenzise <a>
ithegi, hayi ithegi , <button>
kwaye kufuneka uquke tabindex
uphawu loyelelwano.
<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
Izinto disabled
ezinophawu azisebenzi, oku kuthetha ukuba abasebenzisi abanako ukushukuma okanye ukucofa ukuze baqalise ipopover (okanye inqaku lesixhobo). Njengomsebenzi wokusebenza, uya kufuna ukwenza i-popover kwi-wrapper <div>
okanye <span>
kwaye ubhale ngaphezulu pointer-events
kwinto ekhubazekileyo.
Kwiziphembeleli ze-popover ezikhubazekileyo, unokukhetha kwakhona data-trigger="hover"
ukuze i-popover ibonakale njengengxelo ebonwayo kwangoko kubasebenzisi bakho njengoko bengenakulindela ukucofa into ekhubazekileyo.
<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover">
<button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button>
</span>
Vumela iipopovers ngeJavaScript:
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-popover |
isikhongozeli | umtya | into | bubuxoki | bubuxoki | Ifakela ipopover kwinto ethile. Umzekelo: |
umxholo | umtya | into | umsebenzi | '' | Ixabiso lomxholo Ukuba umsebenzi unikiwe, uya kubizwa ngokuba |
ukulibazisa | inombolo | into | 0 | Ukulibazisa ukubonisa kunye nokufihla i-popover (ms) - ayisebenzi kuhlobo lwe-trigger ye-manual Ukuba inani linikiwe, ukulibaziseka kufakwa kuzo zombini ezifihla/umboniso Ulwakhiwo lwento yile: |
html | boolean | bubuxoki | Faka i-HTML kwi-popover. Ukuba ayiyonyani, text indlela yejQuery izakusetyenziswa ukufaka umxholo kwiDOM. Sebenzisa umbhalo ukuba unexhala malunga nohlaselo lwe-XSS. |
ukubekwa | umtya | umsebenzi | 'kunene' | Indlela yokubeka ipopover - auto | phezulu | emazantsi | ekhohlo | kunene. Xa umsebenzi usetyenziswa ukumisela indawo, ibizwa ngokuba yi-popover node ye-DOM njengengxoxo yayo yokuqala kunye nesiqalo se-DOM node njengesibini sayo. Umxholo |
umkhethi | umtya | bubuxoki | bubuxoki | Ukuba umkhethi unikiwe, izinto ze popover ziya kunikezelwa kwiithagethi ezichaziweyo. Ngokwesiqhelo, oku kusetyenziselwa ukwenza umxholo weHTML oguquguqukayo ube neepopovers zongezwe. Bona oku kunye nomzekelo ofundisayo . |
ithempleyithi | umtya | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Isiseko se-HTML esinokusetyenziswa xa usenza ipopover. I-popover's I-popover's
Isiqalelo sokusonga sangaphandle kufuneka sibe |
isihloko | umtya | into | umsebenzi | '' | Ixabiso lesihloko esihlala sihleli ukuba Ukuba umsebenzi unikiwe, uya kubizwa ngokuba |
ukuxhokonxa | umtya | 'cofa' | Ivuswa njani ipopover - cofa | jonga | gxila | incwadi yesandla. Ungadlula ezininzi izichukumisi; bahlule ngesithuba. `incwadana` ayinakudityaniswa naso nasiphi na esinye isiqhushumbisi. |
i-offset | inombolo | umtya | 0 | I-Offset ye-popover malunga nokujoliswe kuyo. 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 wepopover. Yamkela amaxabiso e- 'viewport' , 'window' , 'scrollParent' , okanye i-HTMLElement ireferensi (iJavaScript kuphela). Ngolwazi oluthe vetshe bhekisa kuPopper.js's preventOverflow docs . |
Iimpawu zedatha yepopovers nganye
Ukhetho lwepopovers nganye lunokuchazwa 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 .
Uqalisa iipopovers zengqokelela yezinto.
Ityhila ukuvela kwento ethile. Ibuyisela kumnxeba phambi kokuba i-popover iboniswe (okt phambi kokuba shown.bs.popover
isiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover. Iipopovers ezinesihloko kunye nomxholo onguziro-ubude azizange ziboniswe.
Ifihla imvelaphi yento. Ibuyisela kumnxeba phambi kokuba i-popover ifihliwe (okt phambi kokuba hidden.bs.popover
isiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover.
Itshintsha ipopover yesiqalelo. Ibuyisela kumnxeba phambi kokuba i-popover iboniswe okanye ifihliwe (okt phambi kokuba isiganeko shown.bs.popover
okanye hidden.bs.popover
isiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover.
Ifihla kwaye itshabalalise i-element's popover. Iipopovers ezisebenzisa unikezelo (okuyilwe kusetyenziswa ukhethoselector
) azinakutshatyalaliswa zizodwa kwinzala yezinto ezibangelayo .
Inika i- element's popover isakhono sokuboniswa. Iipopovers zenziwe ngokuzenzekelayo.
Isusa isakhono se popover yesiqalelo esizakuboniswa. I-popover iya kuboniswa kuphela ukuba ivuliwe kwakhona.
Iguqulela isakhono se-popover yesiqalelo esiboniswa okanye sifihlwe.
Ihlaziya indawo ye popover yento.
Uhlobo loMnyhadala | Inkcazo |
---|---|
bonisa.bs.popover | Esi siganeko sivutha ngokukhawuleza xa show kubizwa indlela yomzekelo. |
ibonisiwe.bs.popover | Esi siganeko sigxothwa xa i-popover yenziwe yabonakala kumsebenzisi (iya kulinda iinguqu zeCSS ukuba zigqibe). |
fihla.bs.popover | Esi siganeko sigxothwa ngokukhawuleza xa hide indlela yomzekelo ibiziwe. |
efihliweyo.bs.popover | Esi siganeko sigxothwa xa i-popover igqibile ukufihlwa kumsebenzisi (iya kulinda iinguqu zeCSS ukuba zigqibe). |
ifakiwe.bs.popover | Esi siganeko sigxothwa emva show.bs.popover kwesiganeko xa i-template ye-popover yongezwa kwi-DOM. |