Ama-Popovers
Amadokhumenti nezibonelo zokwengeza ama-popover e-Bootstrap, afana nalawo atholakala ku-iOS, kunoma iyiphi i-elementi kusayithi lakho.
Izinto okufanele uzazi uma usebenzisa i-plugin ye-popover:
- Ama-Popovers athembele kulabhulali yenkampani yangaphandle i- Popper.js ukuze ibekwe. Kufanele ufake i -popper.min.js ngaphambi kwe-bootstrap.js noma usebenzise
bootstrap.bundle.min.js
/bootstrap.bundle.js
equkethe i-Popper.js ukuze ama-popovers asebenze! - Ama-Popovers adinga i- plugin yethiphu yamathuluzi njengokuncika.
- Uma wakha i-JavaScript yethu ngomthombo, idinga
util.js
. - Ama-Popovers angena ngenxa yezizathu zokusebenza, ngakho-ke kuzomele uwaqalise ngokwakho .
- Ubude obuziro
title
namananicontent
ngeke kubonise i-popover. - Cacisa
container: 'body'
ukuze ugweme ukunikeza izinkinga ngezingxenye eziyinkimbinkimbi (njengamaqembu ethu okokufaka, amaqembu wezinkinobho, njll). - Ukucupha ama-popover ezintweni ezifihliwe ngeke kusebenze.
- Ama-Popovers
.disabled
noma ama-disabled
elementi kumele acushwe ku-elementi yokugoqa. - Uma icushwa kusukela kumahange agoqa emigqeni eminingi, ama-popover azobekwa phakathi phakathi kobubanzi bawo wonke amahange. Sebenzisa
white-space: nowrap;
kweyakho<a>
ukugwema lokhu kuziphatha. - Ama-Popovers kumele afihlwe ngaphambi kokuthi kukhishwe izici ezihambisanayo ku-DOM.
Qhubeka ufunda ukuze ubone ukuthi ama-popover asebenza kanjani ngezinye izibonelo.
Enye indlela yokuqalisa wonke ama-popover ekhasini kungaba ukuwakhetha ngesibaluli sawo data-toggle
:
Uma unezitayela ezithile kusici somzali eziphazamisa i-popover, uzofuna ukucacisa inkambiso container
ukuze i-HTML ye-popover ivele ngaphakathi kwaleyo element esikhundleni.
<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>
Kunezinketho ezine ezitholakalayo: kuqondaniswe phezulu, kwesokudla, phansi, nesobunxele.
Sebenzisa i- focus
trigger ukuze ucashise ama-popovers ekuchofozeni okulandelayo komsebenzisi kwento ehlukile kunento yokuguqula.
Imakhaphu eqondile iyadingeka ukuze kuchithwe ngokuchofoza okulandelayo
Ukuze uthole ukuziphatha okufanele kwesiphequluli esiphambene nenkundla, kufanele usebenzise <a>
umaka, hhayi umaka <button>
, futhi kufanele ufake tabindex
isibaluli.
<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>
Ama disabled
-elementi anesibaluli awahlangani, okusho ukuthi abasebenzisi abakwazi ukuhambisa phezulu noma ukuwachofoza ukuze bacuphe i-popover (noma ithiphu yamathuluzi). Njengendlela yokusebenza, uzofuna ukuqalisa i-popover kusuka esonga <div>
noma <span>
bese ubhala pointer-events
phezu kwento ekhubazekile.
Ezibangeli ze- popover ezikhutshaziwe, ungase futhi data-trigger="hover"
uncamele ukuthi i-popover ibonakale njengempendulo esheshayo ebonakalayo kubasebenzisi bakho njengoba bangase bangalindeli ukuchofoza into ekhutshaziwe.
<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>
Nika amandla ama-popovers nge-JavaScript:
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ukuze uthole izibaluli zedatha, faka igama lenketho kokuthi data-
, njengaku data-animation=""
.
Igama | Uhlobo | Okuzenzakalelayo | Incazelo |
---|---|---|---|
izithombe | boolean | iqiniso | Faka inguquko ye-CSS fade ku-popover |
isitsha | umucu | into | amanga | amanga | Yengeza i-popover kusici esithile. Isibonelo: |
okuqukethwe | umucu | into | umsebenzi | '' | Inani lokuqukethwe elizenzakalelayo uma Uma umsebenzi unikiwe, uzobizwa |
ukubambezela | inombolo | into | 0 | Ukubambezeleka ukubonisa nokufihla i-popover (ms) - akusebenzi ohlotsheni lwe-trigger okwenziwa ngesandla Uma inombolo inikezwa, ukubambezeleka kusetshenziswa kukho kokubili ukufihla/umbukiso Isakhiwo sento sithi: |
html | boolean | amanga | Faka i-HTML ku-popover. Uma kungamanga, indlela ye-jQuery text izosetshenziswa ukufaka okuqukethwe ku-DOM. Sebenzisa umbhalo uma ukhathazekile ngokuhlaselwa kwe-XSS. |
ukubekwa | umucu | umsebenzi | 'kwesokudla' | Indlela yokubeka i-popover - auto | phezulu | phansi | kwesokunxele | kwesokudla. Uma umsebenzi usetshenziswa ukunquma ukubekwa, ubizwa nge-popover node ye-DOM njenge-agumenti yayo yokuqala kanye nenodi yesici esicuphayo esithi DOM njengesibili. Umongo |
isikhethi | umucu | amanga | amanga | Uma kunikezwa isikhethi, izinto ze-popover zizothunyelwa kokuhlosiwe okucacisiwe. Empeleni, lokhu kusetshenziselwa ukunika amandla okuqukethwe kwe-HTML okuguquguqukayo ukuze kwengezwe ama-popover. Bheka lokhu kanye nesibonelo esifundisayo . |
isifanekiso | umucu | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Isisekelo se-HTML ongasisebenzisa lapho udala i-popover. Ama-popover Ama-popover
I-elementi yokugoqa engaphandle kufanele ibe |
isihloko | umucu | into | umsebenzi | '' | Inani lesihloko elizenzakalelayo uma Uma umsebenzi unikiwe, uzobizwa |
inhlamvu | umucu | 'chofoza' | I-popover iqalwa kanjani - chofoza | hamba | gxila | imanuwali. Ungadlula izibangeli eziningi; abahlukanise ngesikhala. `imanuwali` ayikwazi ukuhlanganiswa nanoma yisiphi esinye isiqhumiso. |
offset | inombolo | umucu | 0 | I-offset ye-popover ehlobene nokuhlosiwe kwayo. Ukuze uthole ulwazi olwengeziwe bheka ku-Popper.js's offset docs . |
i-fallbackPlacement | umucu | uhlu | 'phenya' | Vumela ukucacisa ukuthi iyiphi indawo ezosetshenziswa u-Popper ekubuyiseleni emuva. Ukuze uthole ulwazi olwengeziwe bheka amadokhumenti okuziphatha ka-Popper.js |
umngcele | umucu | isici | 'scrollParent' | Umkhawulo womkhawulo wokuchichima we-popover. Yamukela amanani we- 'viewport' , 'window' , 'scrollParent' , noma ireferensi ye-HTMLElement (JavaScript kuphela). Ukuze uthole ulwazi olwengeziwe bheka ku-Popper.js's preventOverflow amadokhumenti . |
Izibaluli zedatha ze-popover ngayinye
Izinketho ze-popover ngayinye zingacaciswa ngokusebenzisa izibaluli zedatha, njengoba kuchazwe ngenhla.
Izindlela ze-Asynchronous kanye noshintsho
Zonke izindlela ze-API azivumelanisi futhi ziqala inguquko . Abuyele kofonayo uma sekuqalwa uguquko kodwa lungakapheli . Ngaphezu kwalokho, ikholi yendlela engxenyeni yoshintsho izozitshwa .
Bona imibhalo yethu ye-JavaScript ukuze uthole ulwazi olwengeziwe.
Iqalisa ama-popover eqoqo le-elementi.
Iveza i-popover yento. Ibuyela kofonayo ngaphambi kokuthi i-popover iboniswe (okungukuthi ngaphambi kokuba shown.bs.popover
umcimbi wenzeke). Lokhu kuthathwa njengokuqalwa "ngesandla" kwe-popover. Ama-Popovers kokubili isihloko nokuqukethwe kwawo kunguziro-ubude akukaze kuboniswe.
Ifihla i-popover yento. Ibuyela kofonayo ngaphambi kokuthi i-popover ifihlekile (okungukuthi ngaphambi kokuba hidden.bs.popover
umcimbi wenzeke). Lokhu kuthathwa njengokuqalwa "ngesandla" kwe-popover.
Iguqula i-popover yento. Ibuyela kofonayo ngaphambi kokuthi i-popover iboniswe noma ifihlwe (okungukuthi ngaphambi kokuthi kwenzeke shown.bs.popover
noma hidden.bs.popover
kwenzeke). Lokhu kuthathwa njengokuqalwa "ngesandla" kwe-popover.
Ifihla futhi icekele phansi i-popover yento. Ama-Popovers asebenzisa ukuthunyelwa (okudalwe kusetshenziswa inkethoselector
) awakwazi ukucekelwa phansi ngamanye ezintweni ezibangela inzalo .
Inikeza i-popover yento ikhono lokuboniswa. Ama-Popovers anikwe amandla ngokuzenzakalela.
Isusa amandla okuthi i-popover ye-elementi iboniswe. I-popover izokwazi ukuboniswa kuphela uma inikwe amandla kabusha.
Iguqula ikhono le-popover yento ukuthi iboniswe noma ifihlwe.
Ibuyekeza indawo ye-popover yento.
Uhlobo Lomcimbi | Incazelo |
---|---|
show.bs.popover | Lo mcimbi uvutha ngokushesha lapho show indlela yesibonelo ibizwa. |
kubonisiwe.bs.popover | Lo mcimbi uxoshwa lapho i-popover yenziwe yabonakala kumsebenzisi (izolinda ukuthi izinguquko ze-CSS ziqedele). |
fihla.bs.popover | Lo mcimbi uxoshwa ngokushesha lapho hide indlela yesibonelo ibizwa. |
kufihliwe.bs.popover | Lo mcimbi uyaxoshwa uma i-popover isiqedile ukufihlwa kumsebenzisi (izolinda ukuthi izinguquko ze-CSS ziqedele). |
kufakiwe.bs.popover | Lo mcimbi uxoshwa ngemva show.bs.popover komcimbi lapho isifanekiso se-popover sengeziwe ku-DOM. |