Tsibela kumxholo ophambili Tsiba uye kukhangelo lwamaxwebhu
Check
in English

Iipopovers

Amaxwebhu kunye nemizekelo yokongezwa kweBootstrap poppovers, njengaleyo ifumaneka kwi-iOS, kuyo nayiphi na into ekwisiza sakho.

Isishwankathelo

Izinto omawuzazi xa usebenzisa iplagi yepopover:

  • Abantu abadumileyo baxhomekeke kwithala leencwadi lesithathu iPopper ngokubekwa . Kufuneka ubandakanye popper.min.js phambi bootstrap.js, okanye usebenzise enye bootstrap.bundle.min.jsenePopper.
  • I-Popovers ifuna i- plugin ye -popover njengokuxhomekeka.
  • IiPopovers zingenile ngenxa yezizathu zokusebenza, ke kufuneka uziqalise ngokwakho .
  • Ubude obuziro titlekunye contentnamaxabiso 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 .disabledokanye ielementi kufuneka zivuswe kwinto esongelwayo disabled.
  • Xa isenziwa ukusuka kwii-ankile ezisonga kwimigca emininzi, iipopovers ziya kugxininiswa phakathi kobubanzi beankile ngokubanzi. Sebenzisa .text-nowrapkwi yakho <a>ukunqanda le ukuziphatha.
  • Iipopovers mazifihlwe phambi kokuba izinto ezihambelanayo zisuswe kwiDOM.
  • Iipopovers zinokuvuswa enkosi kwinto engaphakathi kwesithunzi se-DOM.
Ngokungagqibekanga, eli candelo lisebenzisa isicoci esakhelwe ngaphakathi somxholo, esihluba naziphi na izinto zeHTML ezingavumelekanga ngokucacileyo. Bona icandelo lesanitizer kuxwebhu lwethu lweJavaScript ngeenkcukacha ezithe vetshe.
Isiphumo soopopayi seli candelo sixhomekeke prefers-reduced-motionkumbuzo wemidiya. Jonga icandelo leentshukumo ezincitshisiweyo kuxwebhu lwethu lofikelelo .

Qhubeka ufunda ukuze ubone indlela iipopovers ezisebenza ngayo neminye imizekelo.

Imizekelo

Vumela iipopovers

Njengoko kukhankanyiwe ngasentla, kufuneka uqalise iipopovers ngaphambi kokuba zisetyenziswe. Enye indlela yokuqalisa zonke iipopovers kwiphepha iya kuba kukuzikhetha ngophawu lwazo data-bs-toggle, njengaye:

const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))

Idemo ephilayo

Sisebenzisa iJavaScript efana nesnippet engentla ukunikezela ngoku kulandelayo okuphilayo. Izihloko zisetwa kusetyenziswa data-bs-titlekwaye umxholo womzimba usetwe nge data-bs-content.

Zive ukhululekile ukusebenzisa nokuba kukwiHTML titleyakho data-bs-title. Xa titleisetyenziswa, iPopper iya kuyibuyisela ngokuzenzekelayo data-bs-titlexa i element inikezelwa.
html
<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>

Iindlela ezine

Zine iinketho ezikhoyo: phezulu, ekunene, ezantsi, nasekhohlo. Izalathiso ziboniswa xa usebenzisa i-Bootstrap kwi-RTL. Seta data-bs-placementukutshintsha indlela.

html
<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>

Isikocontainer

Xa unezinye izimbo kwinto yomzali ephazamisana ne-popover, uya kufuna ukukhankanya isiko containerukuze i-HTML ye-popover ivele ngaphakathi kweso siqalelo endaweni yoko. Oku kuqhelekileyo kwiitheyibhile eziphendulayo, amaqela egalelo, kunye nokunye okunjalo.

const popover = new bootstrap.Popover('.example-popover', {
  container: 'body'
})

Enye imeko apho uyakufuna ukuseta isiko containerelicacileyo zipopovers ngaphakathi kwincoko yababini yemodal , ukuqinisekisa ukuba ipopover ngokwayo idityaniswe kwimodal. Oku kubaluleke kakhulu kwiipopovers eziqulethe izinto ezisebenzisanayo - iingxoxo zemodal ziyakubamba ugxininiso, ke ngaphandle kokuba ipopover yinto yomntwana wemodali, abasebenzisi abayi kuba nakho ukugxila okanye ukwenza ezi zinto zisebenze.

const popover = new bootstrap.Popover('.example-popover', {
  container: '.modal-body'
})

Iipopovers eziqhelekileyo

Ifakwe kwi-v5.2.0

Unokwenza inkangeleko yeepopovers usebenzisa iCSS variables . Siseta iklasi yesiko data-bs-custom-class="custom-popover"ukuze sijonge inkangeleko yethu yesiko kwaye siyisebenzise ukodlula ezinye zezinto eziguquguqukayo zeCSS zasekhaya.

.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;
}
html
<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>

Lahla ngokucofa okulandelayo

Sebenzisa i- focustrigger 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 tabindexuphawu loyelelwano.

html
<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'
})

Izinto ezikhubazekileyo

Izinto disabledezinophawu azisebenzi, oku kuthetha ukuba abasebenzisi abanako ukushukuma okanye ukucofa ukuze baqalise ipopover (okanye inqaku lesixhobo). Njengomsebenzi wokusebenza, uya kufuna ukwenza i-popover isuka kwisisonga <div>okanye <span>, yenziwe ngokufanelekileyo ikhibhodi-ijolise ekusebenziseni tabindex="0".

Kwiziphembeleli ze-popover ezikhubazekileyo, unokukhetha kwakhona data-bs-trigger="hover focus"ukuze i-popover ibonakale njengengxelo ebonwayo kwangoko kubasebenzisi bakho njengoko bengenakulindela ukucofa into ekhubazekileyo.

html
<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

Izinto eziguquguqukayo

Ifakwe kwi-v5.2.0

Njengenxalenye yendlela yokuguquguquka kwe-Bootstrap ye-CSS, iipopovers ngoku zisebenzisa iiguquguquko ze-CSS zasekhaya .popoverukuze ziphuculwe ukwenziwa ngokwezifiso kwexesha lokwenyani. Amaxabiso okuguquguquka kweCSS asetwe ngeSass, ngoko ke ukwenziwa ngokwezifiso kweSass kusaxhaswa, nako.

  --#{$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);
  

Iinguqu zeSass

$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;

Ukusetyenziswa

Vumela iipopovers ngeJavaScript:

const exampleEl = document.getElementById('example')
const popover = new bootstrap.Popover(exampleEl, options)

Ukwenza iipopovers zisebenzele ikhibhodi kunye nabasebenzisi betekhnoloji abancedisayo

Ukuvumela abasebenzisi bebhodi yezitshixo ukuba bavule iipopovers zakho, kufuneka ubongeze kuphela kwizinto ze-HTML eziqhelekileyo ezijolise kwikhibhodi kwaye ziyasebenzisana (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, kwaye uninzi lweetekhnoloji ezincedisayo okwangoku azibhengezi umxholo we popover kule meko. . Ukongeza, ungathembeli kuphela hovernjengesixhobo se-popovers zakho, njengoko oku kuya kubenza bangakwazi ukuqalisa abasebenzisi bebhodi yezitshixo.

Ngelixa unokufaka i-HTML etyebileyo, ecwangcisiweyo kwiipopovers kunye htmlnokhetho, sicebisa ngamandla ukuba ukunqande ukongeza umthamo ogqithisileyo womxholo. Indlela i-popovers esebenza ngayo ngoku yeyokuba, xa sele ibonisiwe, umxholo wabo ubotshelelwe kwinto yokuqalisa kunye aria-describedbynophawu. Ngenxa yoko, yonke imixholo ye-popover iya kubhengezwa kubasebenzisi betekhnoloji abancedisayo njengomjelo omde, ongaphazanyiswa.

Ukongeza, ngelixa kunokwenzeka ukubandakanya ulawulo olusebenzisanayo (olufana nezinto zefom okanye amakhonkco) kwi-popover yakho (ngokongeza ezi zinto kwiimpawu allowListezivumelekileyo kunye neethegi), qaphela ukuba okwangoku i-popover ayilulawuli ucwangco lwe-keyboard. Xa umsebenzisi webhodi yezitshixo evula i-popover, ingqwalasela ihlala kwi-triggering element, kwaye njengoko i-popover idla ngokungalandeli ngokukhawuleza i-trigger kwisakhiwo soxwebhu, akukho siqinisekiso sokuba ukuya phambili / ukucinezela.TABizakuhambisa umsebenzisi webhodi yezitshixo kwi popover ngokwayo. Ngokufutshane, ukongeza ngokulula izilawuli ezisebenzisanayo kwi-popover kunokwenza olu lawulo lufikeleleke/ lungasebenziseki kubasebenzisi bebhodi yezitshixo kunye nabasebenzisi betekhnoloji encedisayo, okanye ubuncinci yenzela ulungelelwaniso lokugxila ngokubanzi olungekho ngqiqweni. Kwezi meko, cinga ukusebenzisa incoko yababini yemodal endaweni yoko.

Iinketho

Njengoko iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript, unokongeza igama lokhetho ku data-bs-, njengakwi data-bs-animation="{value}". Qinisekisa ukuba utshintshe uhlobo lwecala legama lokukhetha ukusuka kwi " camelCase " ukuya kwi " kebab-case " xa udlula iinketho ngeempawu zedatha. Umzekelo, sebenzisa data-bs-custom-class="beautifier"endaweni ye- data-bs-customClass="beautifier".

Ukusukela kwi-Bootstrap 5.2.0, onke amacandelo axhasa umlinganiso wedatha ogciniweyo wovavanyodata-bs-config onokubeka uqwalaselo lwecandelo olulula njengomtya we-JSON. Xa into ineempawu data-bs-config='{"delay":0, "title":123}'kunye data-bs-title="456"neempawu, ixabiso lokugqibela titleliya kuba 456kunye neempawu zedatha eyahlukileyo ziya kuwenza ngaphezulu amaxabiso anikiweyo data-bs-config. Ukongeza, iimpawu zedatha ezikhoyo ziyakwazi ukubeka ixabiso le-JSON njenge data-bs-delay='{"show":0,"hide":150}'.

Qaphela ukuba ngenxa yezizathu zokhuseleko i sanitize, sanitizeFn, kunye allowListneenketho azikwazi kunikezelwa kusetyenziswa iimpawu zedata.
Igama Uhlobo Ukuhlala kukho Inkcazo
allowList into Ixabiso elimiselweyo Into equlathe iimpawu ezivumelekileyo kunye neethegi.
animation boolean true Faka inguqu ye-CSS fade kwi-popover.
boundary umtya, isiqalelo 'clippingParents' Umda wothintelo lokuphuphumala kwe-popover (usebenza kuphela kwisilungisi sePopper sokuthintela ukuphuphuma). Ngokungagqibekanga, 'clippingParents'ilungile kwaye inokwamkela ireferensi yeHTMLElement (ngeJavaScript kuphela). Ngolwazi oluthe vetshe jonga kuPopper's detectOverflow amaxwebhu .
container umtya, isiqalelo, bubuxoki false Ifakela ipopover kwinto ethile. Umzekelo: container: 'body'. Olu khetho luluncedo kakhulu kuba lukuvumela ukuba ubeke ipopover ekuhambeni koxwebhu kufutshane nesiqalo - esizakunqanda i popover ekudadandeni kude nesiqalo ngexesha lefestile.
content umtya, isiqalelo, umsebenzi '' Ixabiso lomxholo data-bs-contentelihlala likhona ukuba uphawu loyelelwano alukho. Ukuba umsebenzi unikiwe, uya kubizwa ngokuba thisnereferensi iseti kwinto edityaniswe nepopover.
customClass umtya, umsebenzi '' Yongeza iiklasi kwi-popover xa ibonisiwe. Qaphela ukuba ezi klasi ziya kongezwa ukongeza kuzo naziphi na iiklasi ezichazwe kwithempleyithi. Ukongeza iiklasi ezininzi, zahlule ngezithuba: 'class-1 class-2'. Ungaphinda ugqithise umsebenzi ozakubuyisela umtya omnye oqulathe amagama odidi olongezelelweyo.
delay inani, into 0 Ukulibaziseka kokubonisa kunye nokufihla i-popover (ms)—ayisebenzi kuhlobo lwesiqhumiso sesandla. Ukuba inani linikiwe, ukulibaziseka kufakwa kuzo zombini ezifihla/umboniso. Ulwakhiwo lwento yile: delay: { "show": 500, "hide": 100 }.
fallbackPlacements umtya, uluhlu ['top', 'right', 'bottom', 'left'] Chaza ukubekelwa umva ngokubonelela ngoluhlu lweendawo ezibekwe kuluhlu (ngolandelelwano olukhethwayo). Ngolwazi oluthe vetshe jonga kumaxwebhu okuziphatha kaPopper .
html boolean false Vumela i-HTML kwi-popover. Ukuba yinyaniso, iithegi ze-HTML kwi-popover's titleziya kunikezelwa kwi-popover. Ukuba asiyonyani, innerTextipropathi iya kusetyenziswa ukufaka umxholo kwiDOM. Sebenzisa umbhalo ukuba unexhala malunga nohlaselo lwe-XSS.
offset inani, umtya, umsebenzi [0, 0] I-Offset ye-popover malunga nokujoliswe kuyo. Ungagqithisa umtya kwiimpawu zedatha enamaxabiso owahlulwe ngokwekoma njenge: data-bs-offset="10,20". Xa umsebenzi usetyenziselwa ukumisela i-offset, ibizwa ngento equlethe i-popper placement, ireferensi, kunye ne-popper rects njengengxabano yayo yokuqala. Isiqalo se-DOM node sigqithiselwe njengengxoxo yesibini. Umsebenzi kufuneka ubuyisele uluhlu olunamanani amabini: ukutyibilika , umgama . Ngolwazi oluthe vetshe jonga kumaxwebhu e-Popper's offset .
placement umtya, umsebenzi 'top' Indlela yokubeka i-popover: i-auto, phezulu, ezantsi, ekhohlo, ekunene. Xa autoikhankanyiwe, izakuphinda ihlengahlengise i popover. Xa umsebenzi usetyenziswa ukumisela indawo, ibizwa ngokuba yi-popover node ye-DOM njengengxoxo yayo yokuqala kunye nesiqalo se-DOM node njengesibini sayo. Umxholo thisumiselwe kumzekelo we popover.
popperConfig null, into, umsebenzi null Ukutshintsha uqwalaselo lwePopper olungagqibekanga lweBootstrap, bona uqwalaselo lwePopper . Xa umsebenzi usetyenziswa ukwenza uqwalaselo lwePopper, ibizwa ngento equlathe uqwalaselo lwePopper yeBootstrap engagqibekanga. Ikunceda ukuba usebenzise kwaye udibanise ukungagqibeki kunye noqwalaselo lwakho. Umsebenzi kufuneka ubuyisele into yoqwalaselo yePopper.
sanitize boolean true Yenza okanye uvale ucoceko. Ukuba ivuliwe 'template', 'content'kwaye 'title'iinketho ziyakuhlanjululwa.
sanitizeFn null, umsebenzi null Apha ungabonelela ngomsebenzi wakho wokucoca. Oku kunokuba luncedo ukuba ukhetha ukusebenzisa ithala leencwadi elizinikeleyo ukwenza ucoceko.
selector umtya, bubuxoki false Ukuba umkhethi unikiwe, izinto ze popover ziya kunikezelwa kwiithagethi ezichaziweyo. Ngokwesiqhelo, oku kusetyenziselwa ukusebenzisa iipopovers kwizinto ezongeziweyo zeDOM ( jQuery.oninkxaso). Jonga lo mbandela kunye nomzekelo ofundisayo .
template umtya '<div class="popover" role="popover"><div class="popover-arrow"></div><div class="popover-inner"></div></div>' Isiseko se-HTML esinokusetyenziswa xa usenza ipopover. I-popover's titleiya kugalelwa kwi- .popover-inner. .popover-arrowiya kuba lutolo lwe popover. Isiqalelo sokusonga sangaphandle kufuneka sibe .popoverneklasi kunye role="popover".
title umtya, isiqalelo, umsebenzi '' Ixabiso lesihloko esihlala sihleli ukuba titleuphawu loyelelwano alukho. Ukuba umsebenzi unikiwe, uya kubizwa ngokuba thisnereferensi iseti kwinto edityaniswe nepopover.
trigger umtya 'hover focus' Ivuswa njani i-popover: cofa, hambisa phezulu, gxila, incwadana. Unokudlula izichukumisi ezininzi; bahlule ngesithuba. 'manual'ibonisa ukuba i-popover iya kuqalwa ngeprogrammatically ngokusebenzisa .popover('show'), .popover('hide')kunye .popover('toggle')neendlela; eli xabiso alinakudityaniswa naso nasiphi na esinye isiqhumiso. 'hover'ngokwayo iyakukhokelela kwiipopovers ezingenakuqaliswa ngebhodi yezitshixo, kwaye kufuneka isetyenziswe kuphela ukuba ezinye iindlela zokuhambisa ulwazi olufanayo kubasebenzisi bebhodi yezitshixo zikhona.

Iimpawu zedatha yepopovers nganye

Ukhetho lwepopovers nganye lunokuchazwa ngokusetyenziswa kweempawu zedatha, njengoko kucacisiwe ngasentla.

Ukusebenzisa umsebenzi ngepopperConfig

const popover = new bootstrap.Popover(element, {
  popperConfig(defaultBsPopperConfig) {
    // const newPopperConfig = {...}
    // use defaultBsPopperConfig if needed...
    // return newPopperConfig
  }
})

Iindlela

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 .

Jonga uxwebhu lwethu lweJavaScript ngolwazi olungakumbi .

Indlela Inkcazo
disable Isusa isakhono se popover yesiqalelo esizakuboniswa. I-popover iya kuboniswa kuphela ukuba ivuliwe kwakhona.
dispose Ifihla kwaye itshabalalise i-popover yento (Isusa idatha egciniweyo kwi-DOM element). Iipopovers ezisebenzisa unikezelo (okuyilwe kusetyenziswa ukhethoselector ) azinakutshatyalaliswa zizodwa kwinzala yezinto ezibangelayo .
enable Inika i- element's popover isakhono sokuboniswa. Iipopovers zenziwe ngokuzenzekelayo.
getInstance Indlela engatshintshiyo ekuvumela ukuba ufumane umzekelo we popover onxulunyaniswa nento yeDOM.
getOrCreateInstance Indlela engatshintshiyo ekuvumela ukuba ufumane umzekelo we-popover onxulunyaniswa nento yeDOM, okanye wenze entsha ukuba ayiqalwanga.
hide Ifihla imvelaphi yento. Ibuyisela kumnxeba phambi kokuba i-popover ifihliwe (okt phambi kokuba hidden.bs.popoverisiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover.
setContent Inika indlela yokutshintsha umxholo we-popover emva kokuqalwa kwayo.
show Ityhila ukuvela kwento ethile. Ibuyisela kumnxeba phambi kokuba i-popover iboniswe (okt phambi kokuba shown.bs.popoverisiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover. Iipopovers ezinesihloko kunye nomxholo wazo zombini ubude obungu-zero azizange ziboniswe.
toggle Itshintsha ipopover yesiqalelo. Ibuyisela kumnxeba phambi kokuba i-popover iboniswe okanye ifihliwe (okt phambi kokuba isiganeko shown.bs.popoverokanye hidden.bs.popoverisiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover.
toggleEnabled Iguqulela isakhono se-popover yesiqalelo esiboniswa okanye sifihlwe.
update Ihlaziya 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'
})
Indlela setContentyamkela objectingxoxo, apho isitshixo sepropathi ngasinye singumkhethi osebenzayo stringngaphakathi kwetemplate yepopover, kwaye ixabiso lepropathi ngalinye elinxulumeneyo linokuba string| element| function| null

Iziganeko

Isiganeko Inkcazo
hide.bs.popover Esi siganeko sigxothwa ngokukhawuleza xa hideindlela yomzekelo ibiziwe.
hidden.bs.popover Esi siganeko sigxothwa xa i-popover igqibile ukufihlwa kumsebenzisi (iya kulinda iinguqu zeCSS ukuba zigqibe).
inserted.bs.popover Esi siganeko sigxothwa emva show.bs.popoverkwesiganeko xa i-template ye-popover yongezwa kwi-DOM.
show.bs.popover Esi siganeko sivutha ngokukhawuleza xa showkubizwa indlela yomzekelo.
shown.bs.popover Esi siganeko sigxothwa xa i-popover yenziwe yabonakala kumsebenzisi (iya kulinda iinguqu zeCSS ukuba zigqibe).
const myPopoverTrigger = document.getElementById('myPopover')
myPopoverTrigger.addEventListener('hidden.bs.popover', () => {
  // do something...
})