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 kumtapo wezincwadi wenkampani yangaphandle we - Popper ukuze abekwe esikhundleni. Kufanele ufake i -popper.min.js ngaphambili
bootstrap.js
, noma usebenzise eyodwabootstrap.bundle.min.js
equkethe i-Popper. - Ama-Popovers adinga i- plugin ye -popover njengokuncika.
- 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.
prefers-reduced-motion
embuzweni wemidiya. Bona ingxenye
yokunyakaza encishisiwe yemibhalo yethu yokufinyeleleka .
Qhubeka ufunda ukuze ubone ukuthi ama-popover asebenza kanjani ngezinye izibonelo.
Izibonelo
Nika amandla ama-popovers
Njengoba kushiwo ngenhla, kufanele uqalise ama-popover ngaphambi kokuthi asetshenziswe. Enye indlela yokuqalisa wonke ama-popover ekhasini kungaba ukuwakhetha ngesibaluli sawo data-bs-toggle
, njengalokhu:
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
Idemo ebukhoma
Sisebenzisa i-JavaScript efana namazwibela angenhla ukuze sinikeze i-popover elandelayo ebukhoma. Izihloko zisethwa ngokusebenzisa data-bs-title
futhi okuqukethwe komzimba kusethwa nge- data-bs-content
.
title
noma
data-bs-title
ku-HTML yakho. Uma
title
isetshenziswa, i-Popper izoyishintsha ngokuzenzakalelayo
data-bs-title
lapho isetshenziswa.
<button type="button" class="btn btn-lg btn-danger" data-bs-toggle="popover" data-bs-title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
Izikhombisi-ndlela ezine
Kunezinketho ezine ezitholakalayo: phezulu, kwesokudla, phansi, nakwesokunxele. Izikhombisi-ndlela ziboniswa uma usebenzisa i-Bootstrap ku-RTL. Setha data-bs-placement
ukushintsha isiqondiso.
<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="top" data-bs-content="Top popover">
Popover on top
</button>
<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right" data-bs-content="Right popover">
Popover on right
</button>
<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-content="Bottom popover">
Popover on bottom
</button>
<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="left" data-bs-content="Left popover">
Popover on left
</button>
Ngokwezifisocontainer
Uma unezitayela ezithile kusici somzali eziphazamisa i-popover, uzofuna ukucacisa inkambiso container
ukuze i-HTML ye-popover ivele ngaphakathi kwaleyo element esikhundleni. Lokhu kuvamile kumathebula asabelayo, amaqembu okokufaka, nokunye okunjalo.
const popover = new bootstrap.Popover('.example-popover', {
container: 'body'
})
Esinye isimo lapho uzofuna ukusetha isiko container
elisobala ama-popovers ngaphakathi kwengxoxo ye- modal , ukuze wenze isiqiniseko sokuthi i-popover ngokwayo yengezwe ku-modal. Lokhu kubaluleke kakhulu kuma-popover aqukethe izinto ezisebenzisanayo - izingxoxo ze-modal zizobamba ukugxila, ngakho-ke ngaphandle uma i-popover iyingxenye yengane ye-modal, abasebenzisi ngeke bakwazi ukugxila noma benze lezi zinto zisebenze.
const popover = new bootstrap.Popover('.example-popover', {
container: '.modal-body'
})
Ama-popover angokwezifiso
Kwengezwe ku-v5.2.0Ungenza ngendlela oyifisayo ukubukeka kwama-popover usebenzisa okuguquguqukayo kwe-CSS . Sisetha ikilasi langokwezifiso data-bs-custom-class="custom-popover"
ukuze sandise ukubukeka kwethu kwangokwezifiso futhi sikusebenzise ukuze sibhale ngaphezu kwezinye zezinto eziguquguqukayo zendawo ze-CSS.
.custom-popover {
--bs-popover-max-width: 200px;
--bs-popover-border-color: var(--bs-primary);
--bs-popover-header-bg: var(--bs-primary);
--bs-popover-header-color: var(--bs-white);
--bs-popover-body-padding-x: 1rem;
--bs-popover-body-padding-y: .5rem;
}
<button type="button" class="btn btn-secondary"
data-bs-toggle="popover" data-bs-placement="right"
data-bs-custom-class="custom-popover"
data-bs-title="Custom popover"
data-bs-content="This popover is themed via CSS variables.">
Custom popover
</button>
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.
<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-bs-toggle="popover" data-bs-trigger="focus" data-bs-title="Dismissible popover" data-bs-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
const popover = new bootstrap.Popover('.popover-dismiss', {
trigger: 'focus'
})
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 ku-wrapper <div>
noma <span>
, eyenziwe kahle ikhibhodi-igxile usebenzisa tabindex="0"
.
Ezibangeli ze- popover ezikhutshaziwe, ungase futhi data-bs-trigger="hover focus"
uncamele ukuthi i-popover ibonakale njengempendulo esheshayo ebonakalayo kubasebenzisi bakho njengoba bangase bangalindeli ukuchofoza into ekhutshaziwe.
<span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-content="Disabled popover">
<button class="btn btn-primary" type="button" disabled>Disabled button</button>
</span>
CSS
Okuguquguqukayo
Kwengezwe ku-v5.2.0Njengengxenye yendlela yokuguquguquka kwe-CSS ye-Bootstrap, ama-popover manje asebenzisa okuguquguqukayo kwasendaweni kwe-CSS .popover
ukuze enze ngokwezifiso isikhathi sangempela esithuthukisiwe. Amanani okuguquguquka kwe-CSS asethwa nge-Sass, ngakho ukwenza ngokwezifiso kwe-Sass kusasekelwa, nakho.
--#{$prefix}popover-zindex: #{$zindex-popover};
--#{$prefix}popover-max-width: #{$popover-max-width};
@include rfs($popover-font-size, --#{$prefix}popover-font-size);
--#{$prefix}popover-bg: #{$popover-bg};
--#{$prefix}popover-border-width: #{$popover-border-width};
--#{$prefix}popover-border-color: #{$popover-border-color};
--#{$prefix}popover-border-radius: #{$popover-border-radius};
--#{$prefix}popover-inner-border-radius: #{$popover-inner-border-radius};
--#{$prefix}popover-box-shadow: #{$popover-box-shadow};
--#{$prefix}popover-header-padding-x: #{$popover-header-padding-x};
--#{$prefix}popover-header-padding-y: #{$popover-header-padding-y};
@include rfs($popover-header-font-size, --#{$prefix}popover-header-font-size);
--#{$prefix}popover-header-color: #{$popover-header-color};
--#{$prefix}popover-header-bg: #{$popover-header-bg};
--#{$prefix}popover-body-padding-x: #{$popover-body-padding-x};
--#{$prefix}popover-body-padding-y: #{$popover-body-padding-y};
--#{$prefix}popover-body-color: #{$popover-body-color};
--#{$prefix}popover-arrow-width: #{$popover-arrow-width};
--#{$prefix}popover-arrow-height: #{$popover-arrow-height};
--#{$prefix}popover-arrow-border: var(--#{$prefix}popover-border-color);
Izinguquko ze-Sass
$popover-font-size: $font-size-sm;
$popover-bg: $white;
$popover-max-width: 276px;
$popover-border-width: $border-width;
$popover-border-color: var(--#{$prefix}border-color-translucent);
$popover-border-radius: $border-radius-lg;
$popover-inner-border-radius: subtract($popover-border-radius, $popover-border-width);
$popover-box-shadow: $box-shadow;
$popover-header-font-size: $font-size-base;
$popover-header-bg: shade-color($popover-bg, 6%);
$popover-header-color: $headings-color;
$popover-header-padding-y: .5rem;
$popover-header-padding-x: $spacer;
$popover-body-color: $body-color;
$popover-body-padding-y: $spacer;
$popover-body-padding-x: $spacer;
$popover-arrow-width: 1rem;
$popover-arrow-height: .5rem;
Ukusetshenziswa
Nika amandla ama-popovers nge-JavaScript:
const exampleEl = document.getElementById('example')
const popover = new bootstrap.Popover(exampleEl, options)
Ukwenza ama-popover asebenzele abasebenzisi bekhibhodi nobuchwepheshe obusizayo
Ukuze uvumele abasebenzisi bekhibhodi ukuthi benze ama-popover akho asebenze, kufanele uwangeze kuphela ezintweni ze-HTML ngokuvamile ezigxile kukhibhodi futhi ezisebenzisanayo (njengezixhumanisi noma izilawuli zefomu). Nakuba izakhi ze-HTML ezingafanele (ezifana no- <span>
s) zingenziwa zigxile ngokwengeza tabindex="0"
isibaluli, lokhu kuzongeza izitobhi zethebhu ezingase zicasule futhi zidideke ezintweni ezingahlangani kubasebenzisi bekhibhodi, futhi ubuchwepheshe obusiza obuningi okwamanje abumemezeli okuqukethwe kwe-popover kulesi simo. . Ukwengeza, unganciki kuphela hover
njengesicuphi se-popover yakho, njengoba lokhu kuzobenza bangakwazi ukucupha abasebenzisi bekhibhodi.
Nakuba ungakwazi ukufaka i-HTML ecebile, ehlelekile kuma-popover html
ngenketho, sincoma ngokuqinile ukuthi ugweme ukungeza inani elidlulele lokuqukethwe. Indlela ama-popovers asebenza ngayo njengamanje ukuthi, uma sekubonisiwe, okuqukethwe kwawo kuhlanganiswe nesici sokuqala aria-describedby
nesibaluli. Njengomphumela, konke okuqukethwe kwe-popover kuzomenyezelwa kubasebenzisi bobuchwepheshe obusizayo njengokusakaza okukodwa okude, okungaphazamiseki.
Ukwengeza, nakuba kungenzeka futhi ukufaka phakathi izilawuli ezisebenzisanayo (njengezinto zefomu noma izixhumanisi) ku-popover yakho (ngokwengeza lezi zakhi kuzibaluli allowList
namathegi avunyelwe), qaphela ukuthi okwamanje i-popover ayilawuli ukuhleleka kokugxila kwekhibhodi. Uma umsebenzisi wekhibhodi evula i-popover, ukugxila kuhlala kusici esicuphayo, futhi njengoba i-popover ngokuvamile ingasilandeli ngokushesha isicuphi esakhiweni sedokhumenti, asikho isiqinisekiso sokuthi ukuya phambili/ukucindezela.TABizohambisa umsebenzisi wekhibhodi ku-popover ngokwayo. Ngamafuphi, ukumane ungeze izilawuli ezisebenzisanayo ku-popover kungenzeka kwenze lezi zilawuli zingafinyeleleki/zingasetshenziswa kubasebenzisi bekhibhodi nabasebenzisi bobuchwepheshe obusizayo, noma okungenani kwenzele ukuhleleka kokugxila okuphelele okungenangqondo. Kulezi zimo, cabanga ukusebenzisa ingxoxo ye-modal esikhundleni salokho.
Izinketho
Njengoba izinketho zingadluliswa ngezibaluli zedatha noma i-JavaScript, ungakwazi ukwengeza igama lenketho kokuthi data-bs-
, njengaku data-bs-animation="{value}"
. Qiniseka ukuthi ushintsha uhlobo lwekesi legama lenketho lisuka ku- “ camelCase ” liye ku- “ kebab-case ” lapho udlulisa izinketho ngezibaluli zedatha. Isibonelo, sebenzisa data-bs-custom-class="beautifier"
esikhundleni se- data-bs-customClass="beautifier"
.
Kusukela ku-Bootstrap 5.2.0, zonke izingxenye zisekela isibaluli sedatha egodliwe esihlolwayodata-bs-config
esingafaka ukucushwa kwengxenye elula njengochungechunge lwe-JSON. Uma into inezibaluli , inani lokugcina lizoba data-bs-config='{"delay":0, "title":123}'
futhi izibaluli zedatha ezihlukene zizokhipha amanani anikezwe ngomhla ka- . Ngaphezu kwalokho, izibaluli zedatha ezikhona ziyakwazi ukubeka amanani e-JSON afana .data-bs-title="456"
title
456
data-bs-config
data-bs-delay='{"show":0,"hide":150}'
sanitize
,
sanitizeFn
,
allowList
nezinketho azikwazi ukunikezwa kusetshenziswa izibaluli zedatha.
Igama | Uhlobo | Okuzenzakalelayo | Incazelo |
---|---|---|---|
allowList |
into | Inani elizenzakalelayo | Into equkethe izibaluli namathegi avunyelwe. |
animation |
boolean | true |
Faka inguquko ye-CSS fade ku-popover. |
boundary |
umucu, isici | 'clippingParents' |
Umkhawulo womkhawulo wokuchichima we-popover (usebenza kuphela kusilungisi se-Popper's preventOverflow). Ngokuzenzakalelayo, iyona 'clippingParents' futhi ingamukela ireferensi ye-HTMLElement (nge-JavaScript kuphela). Ukuze uthole ulwazi olwengeziwe bheka amadokhumenti e-Popper's detectOverflow . |
container |
umucu, isici, amanga | false |
Yengeza i-popover kusici esithile. Isibonelo: container: 'body' . Le nketho iwusizo kakhulu ngoba ikuvumela ukuthi ubeke i-popover ekuhambeni kwedokhumenti eduze kwesici esicuphayo - okuzovimbela i-popover ekuntanteni isuke kusici esicuphayo ngesikhathi sokushintsha usayizi wewindi. |
content |
umucu, isici, umsebenzi | '' |
Inani lokuqukethwe elizenzakalelayo uma data-bs-content isibaluli singekho. Uma umsebenzi unikiwe, uzobizwa this nereferensi yawo esethwe ku-elementi i-popover enamathiselwe kuyo. |
customClass |
umucu, umsebenzi | '' |
Engeza amakilasi ku-popover uma iboniswa. Qaphela ukuthi lawa makilasi azokwengezwa ngaphezu kwanoma yimaphi amakilasi ashiwo kusifanekiso. Ukwengeza amakilasi amaningi, wahlukanise ngezikhala: 'class-1 class-2' . Ungakwazi futhi ukudlulisa umsebenzi okufanele ubuyisele uchungechunge olulodwa oluqukethe amagama ekilasi engeziwe. |
delay |
inombolo, into | 0 |
Ukubambezeleka kokubonisa nokufihla i-popover (ms)—akusebenzi ohlotsheni lwe-trigger okwenziwa ngesandla. Uma inombolo inikezwa, ukubambezeleka kusetshenziswa kukho kokubili ukufihla/umbukiso. Isakhiwo sento sithi: delay: { "show": 500, "hide": 100 } . |
fallbackPlacements |
umucu, uhlu | ['top', 'right', 'bottom', 'left'] |
Chaza ukubekwa emuva ngokunikeza uhlu lokubekwa ngokulandelana (ngokulandelana kokuthandayo). Ukuze uthole ulwazi olwengeziwe bheka amadokhumenti okuziphatha ka-Popper . |
html |
boolean | false |
Vumela i-HTML ku-popover. Uma kuyiqiniso, amathegi e-HTML kuma-popover title azonikezwa ku-popover. Uma kungamanga, innerText isakhiwo sizosetshenziselwa ukufaka okuqukethwe ku-DOM. Sebenzisa umbhalo uma ukhathazekile ngokuhlaselwa kwe-XSS. |
offset |
inombolo, intambo, umsebenzi | [0, 0] |
I-offset ye-popover ehlobene nokuhlosiwe kwayo. Ungadlulisa uchungechunge kuzibaluli zedatha ngamavelu ahlukaniswe ngokhefana afana nalawa: data-bs-offset="10,20" . Uma umsebenzi usetshenziselwa ukunquma i-offset, ubizwa ngento equkethe ukubekwa kwe-popper, ireferensi, kanye ne-popper rects njengempikiswano yayo yokuqala. Into eqalisayo inodi ye-DOM idluliswa njengempikiswano yesibili. Umsebenzi kufanele ubuyisele amalungu afanayo anezinombolo ezimbili: ukushushuluza , ibanga . Ukuze uthole ulwazi olwengeziwe bheka amadokhumenti e-Popper's offset . |
placement |
umucu, umsebenzi | 'top' |
Indlela yokubeka i-popover: okuzenzakalelayo, phezulu, phansi, kwesokunxele, kwesokudla. Uma auto kucacisiwe, izoqondisa kabusha i-popover ngamandla. Uma umsebenzi usetshenziswa ukunquma ukubekwa, ubizwa nge-popover node ye-DOM njenge-agumenti yayo yokuqala kanye nenodi yesici esicuphayo esithi DOM njengesibili. Umongo this usethelwe kusibonelo se-popover. |
popperConfig |
null, into, umsebenzi | null |
Ukuze uguqule ukucushwa kwe-Popper okuzenzakalelayo kwe-Bootstrap, bona ukucushwa kwe-Popper . Uma umsebenzi usetshenziselwa ukudala ukucushwa kwe-Popper, kubizwa ngento equkethe ukucushwa kwe-Popper okuzenzakalelayo kwe-Bootstrap. Ikusiza ukuthi usebenzise futhi uhlanganise okumisiwe nokucushwa kwakho. Umsebenzi kufanele ubuyisele into yokumisa ye-Popper. |
sanitize |
boolean | true |
Nika amandla noma vala ukukhucululwa kwendle. Uma yenziwe yasebenza 'template' , 'content' futhi 'title' izinketho zizohlanzwa. |
sanitizeFn |
null, umsebenzi | null |
Lapha ungakwazi ukunikeza umsebenzi wakho we-sanitize. Lokhu kungaba usizo uma ukhetha ukusebenzisa umtapo wolwazi ozinikele ukwenza ukukhucululwa kwendle. |
selector |
intambo, amanga | false |
Uma kunikezwa isikhethi, izinto ze-popover zizothunyelwa kokuhlosiwe okucacisiwe. Empeleni, lokhu kusetshenziselwa ukusebenzisa ama-popover kuma-elementi e-DOM angezwe ngamandla ( jQuery.on usekelo). Bheka lolu daba kanye nesibonelo esifundisayo . |
template |
umucu | '<div class="popover" role="popover"><div class="popover-arrow"></div><div class="popover-inner"></div></div>' |
Isisekelo se-HTML ongasisebenzisa lapho udala i-popover. Ama-popover title azofakwa ku- .popover-inner . .popover-arrow izoba umcibisholo we-popover. I-elementi yokugoqa engaphandle kufanele ibe .popover nekilasi kanye role="popover" . |
title |
umucu, isici, umsebenzi | '' |
Inani lesihloko elizenzakalelayo uma title isibaluli singekho. Uma umsebenzi unikiwe, uzobizwa this nereferensi yawo esethwe ku-elementi i-popover enamathiselwe kuyo. |
trigger |
umucu | 'hover focus' |
Iqala kanjani i-popover: chofoza, hambisa phezulu, gxila, imanuwali. Ungadlula izibangeli eziningi; abahlukanise ngesikhala. 'manual' ibonisa ukuthi i-popover izocushwa ngokohlelo nge- .popover('show') , .popover('hide') kanye .popover('toggle') nezindlela; leli nani alikwazi ukuhlanganiswa nanoma yisiphi esinye isiqalisi. 'hover' ngokwalo kuzophumela kuma-popover angeke acushwe ngekhibhodi, futhi kufanele asetshenziswe kuphela uma ezinye izindlela zokudlulisa ulwazi olufanayo lwabasebenzisi bekhibhodi zikhona. |
Izibaluli zedatha ze-popover ngayinye
Izinketho ze-popover ngayinye zingacaciswa ngokusebenzisa izibaluli zedatha, njengoba kuchazwe ngenhla.
Ukusebenzisa umsebenzi ngepopperConfig
const popover = new bootstrap.Popover(element, {
popperConfig(defaultBsPopperConfig) {
// const newPopperConfig = {...}
// use defaultBsPopperConfig if needed...
// return newPopperConfig
}
})
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 .
Indlela | Incazelo |
---|---|
disable |
Isusa amandla okuthi i-popover ye-elementi iboniswe. I-popover izokwazi ukuboniswa kuphela uma inikwe amandla kabusha. |
dispose |
Ifihla futhi icekele phansi i-popover ye-elementi (Isusa idatha egciniwe kusici se-DOM). Ama-Popovers asebenzisa ukuthunyelwa (okudalwe kusetshenziswa inkethoselector ) awakwazi ukucekelwa phansi ngamanye ezintweni ezibangela inzalo . |
enable |
Inikeza i-popover yento ikhono lokuboniswa. Ama-Popovers anikwe amandla ngokuzenzakalela. |
getInstance |
Indlela emile ekuvumela ukuthi uthole isenzakalo se- popover esihlotshaniswa nento ye-DOM. |
getOrCreateInstance |
Indlela emile ekuvumela ukuthi uthole isenzakalo se- popover esihlotshaniswa nento ye-DOM, noma udale entsha uma kwenzeka ingaqaliswanga. |
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. |
setContent |
Inikeza indlela yokushintsha okuqukethwe kwe-popover ngemva kokuqaliswa kwayo. |
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 isihloko nokuqukethwe kwawo kokubili okuwuziro-ubude akukaze kuboniswe. |
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. |
toggleEnabled |
Iguqula ikhono le-popover yento ukuthi iboniswe noma ifihlwe. |
update |
Ibuyekeza indawo ye-popover yento. |
// getOrCreateInstance example
const popover = bootstrap.Popover.getOrCreateInstance('#example') // Returns a Bootstrap popover instance
// setContent example
myPopover.setContent({
'.popover-header': 'another title',
'.popover-body': 'another content'
})
setContent
yamukela
object
impikiswano, lapho ukhiye wendawo ngayinye uyisikhethi esivumelekile
string
ngaphakathi kwesifanekiso se-popover, futhi inani lesakhiwo ngalinye elihlobene lingaba
string
|
element
|
function
|
null
Imicimbi
Umcimbi | Incazelo |
---|---|
hide.bs.popover |
Lo mcimbi uxoshwa ngokushesha lapho hide indlela yesibonelo ibizwa. |
hidden.bs.popover |
Lo mcimbi uyaxoshwa uma i-popover isiqedile ukufihlwa kumsebenzisi (izolinda ukuthi izinguquko ze-CSS ziqedele). |
inserted.bs.popover |
Lo mcimbi uxoshwa ngemva show.bs.popover komcimbi lapho isifanekiso se-popover sengeziwe ku-DOM. |
show.bs.popover |
Lo mcimbi uvutha ngokushesha lapho show indlela yesibonelo ibizwa. |
shown.bs.popover |
Lo mcimbi uxoshwa lapho i-popover yenziwe yabonakala kumsebenzisi (izolinda ukuthi izinguquko ze-CSS ziqedele). |
const myPopoverTrigger = document.getElementById('myPopover')
myPopoverTrigger.addEventListener('hidden.bs.popover', () => {
// do something...
})