Ama-Popovers
Amadokhumenti nezibonelo zokwengeza ama-popover e-Bootstrap, afana nalawo atholakala ku-iOS, kunoma iyiphi i-elementi kusayithi lakho.
Uhlolojikelele
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
.text-nowrap
kweyakho<a>
ukugwema lokhu kuziphatha. - Ama-Popovers kumele afihlwe ngaphambi kokuthi kukhishwe izici ezihambisanayo ku-DOM.
- Ama-Popovers angaqalwa ngenxa yento engaphakathi kwesithunzi se-DOM.
Umthelela wokugqwayiza wale ngxenye uncike prefers-reduced-motion
embuzweni wemidiya. Bona ingxenye yokunyakaza encishisiwe yemibhalo yethu yokufinyeleleka .
Qhubeka ufunda ukuze ubone ukuthi ama-popover asebenza kanjani ngezinye izibonelo.
Isibonelo: Nika amandla ama-popovers yonke indawo
Enye indlela yokuqalisa wonke ama-popover ekhasini kungaba ukuwakhetha ngesibaluli sawo data-toggle
:
Isibonelo: Ukusebenzisa container
inketho
Uma unezitayela ezithile kusici somzali eziphazamisa i-popover, uzofuna ukucacisa inkambiso container
ukuze i-HTML ye-popover ivele ngaphakathi kwaleyo element esikhundleni.
Isibonelo
Izikhombisi-ndlela ezine
Kunezinketho ezine ezitholakalayo: kuqondaniswe phezulu, kwesokudla, phansi, nesobunxele.
Cashisa ngokuchofoza okulandelayo
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.
Izakhi ezikhutshaziwe
Izinto disabled
ezinesibaluli azihlangani, okusho ukuthi abasebenzisi abakwazi ukuhambisa phezulu noma ukuzichofoza 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.
Ukusetshenziswa
Nika amandla ama-popovers nge-JavaScript:
Izinketho
Izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript. Ngezibaluli 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. manual 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
Izindlela ze-Asynchronous kanye noshintsho
Zonke izindlela ze-API azivumelanisi futhi ziqala inguquko . Babuyele kofonayo uma sekuqalwa uguquko kodwa lungakapheli . Ngokungeziwe, ikholi yendlela engxenyeni yoshintsho izozitshwa .
Bheka imibhalo yethu ye-JavaScript ukuze uthole ulwazi olwengeziwe .
$().popover(options)
Iqalisa ama-popover eqoqo le-elementi.
.popover('show')
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.
.popover('hide')
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.
.popover('toggle')
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.
.popover('dispose')
Hides and destroys an element’s popover. Popovers that use delegation (which are created using the selector
option) cannot be individually destroyed on descendant trigger elements.
.popover('enable')
Gives an element’s popover the ability to be shown. Popovers are enabled by default.
.popover('disable')
Removes the ability for an element’s popover to be shown. The popover will only be able to be shown if it is re-enabled.
.popover('toggleEnabled')
Toggles the ability for an element’s popover to be shown or hidden.
.popover('update')
Updates the position of an element’s popover.
Events
Event Type | Description |
---|---|
show.bs.popover | This event fires immediately when the show instance method is called. |
shown.bs.popover | This event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete). |
hide.bs.popover | Lo mcimbi uxoshwa ngokushesha lapho hide indlela yesibonelo ibizwa. |
kufihliwe.bs.popover | Lo mcimbi uxoshwa lapho 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. |