Bafutsana
Litokomane le mehlala ea ho kenyelletsa li-popovers tsa Bootstrap, joalo ka tse fumanehang ho iOS, nthong efe kapa efe sebakeng sa hau sa marang-rang.
Kakaretso
Lintho tseo u lokelang ho li tseba ha u sebelisa plugin ea popover:
- Popovers e itšetlehile ka laeborari ea batho ba boraro ea Popper bakeng sa maemo. U tlameha ho kenyelletsa popper.min.js pele ho
bootstrap.js
, kapa u sebelise ebootstrap.bundle.min.js
nang le Popper. - Li-Popovers li hloka plugin ea popover joalo ka ts'epo.
- Li-Popovers li khetha ho kena ka mabaka a ts'ebetso, kahoo u tlameha ho li qala ka bouena .
- Bolelele ba zero
title
lecontent
litekanyetso li ke ke tsa bontša popover. - Hlakisa
container: 'body'
ho qoba ho fana ka mathata ka likarolo tse rarahaneng (joalo ka lihlopha tsa rona tsa ho kenya, lihlopha tsa likonopo, joalo-joalo). - Ho kenya li-popover linthong tse patiloeng ho ke ke ha sebetsa.
- Li-Popovers tsa
.disabled
kapadisabled
li-elementi li tlameha ho hlahisoa holim'a karolo ea wrapper. - Ha li ts'oaroa ho tsoa ho li-ankora tse pota-potileng mela e mengata, li-popover li tla behoa bohareng ba bophara ba li-ankora. Sebelisa
.text-nowrap
ho hao<a>
ho qoba boitšoaro bona. - Li-Popovers li tlameha ho patoa pele likarolo tsa tsona tse tsamaellanang li tlosoa ho DOM.
- Popovers e ka hlahisoa ka lebaka la ntho e ka hare ho moriti oa DOM.
prefers-reduced-motion
potso ea media. Sheba karolo e
fokolitsoeng ea motsamao oa litokomane tsa phihlello ea rona .
Tsoela pele ho bala ho bona hore na popover e sebetsa joang ka mehlala e meng.
Mehlala
Lumella li-popovers
Joalokaha ho boletsoe ka holimo, o tlameha ho qala li-popover pele li ka sebelisoa. Tsela e 'ngoe ea ho qala li-popovers tsohle leqepheng e tla ba ho li khetha ka data-bs-toggle
tšobotsi ea tsona, joalo ka:
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
Pontšo e phelang
Re sebelisa JavaScript e tšoanang le snippet e ka holimo ho fana ka popover e latelang. Litlotla li behiloe ka ho sebelisa data-bs-title
'me litaba tsa' mele li hlophisoa ka data-bs-content
.
title
kapa
data-bs-title
ho HTML ea hau. Ha
title
e sebelisoa, Popper e tla e nkela sebaka ka bo eona
data-bs-title
ha elemente e etsoa.
<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>
Litsela tse 'ne
Ho na le likhetho tse 'ne: holimo, ho le letona, tlase le ho le letšehali. Litaelo li bonts'oa ha u sebelisa Bootstrap ho RTL. Beha data-bs-placement
ho fetola tsela.
<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>
Tloaelocontainer
Ha u e-na le mekhoa e meng ea ntho ea motsoali e sitisang popover, u tla batla ho hlalosa tloaelo container
e le hore HTML ea popover e hlahe ka har'a ntho eo ho e-na le hoo. Sena se tloaelehile litafoleng tse arabelang, lihlopha tsa ho kenya letsoho, joalo-joalo.
const popover = new bootstrap.Popover('.example-popover', {
container: 'body'
})
Boemo bo bong moo u tla batla ho beha tloaelo e hlakileng container
ke popovers ka hare ho modal dialog , ho etsa bonnete ba hore popover ka boeona e kenyelelitsoe ho modal. Sena se bohlokoa haholo bakeng sa li-popovers tse nang le likarolo tse sebetsanang - lipuisano tsa modal li tla ts'oara maikutlo, kahoo ntle le haeba popover e le karolo ea ngoana ea modal, basebelisi ba ke ke ba khona ho tsepamisa maikutlo kapa ho kenya tšebetsong likarolo tsena tse sebetsanang.
const popover = new bootstrap.Popover('.example-popover', {
container: '.modal-body'
})
Li-popovers tse tloaelehileng
E kentsoe ho v5.2.0U ka khona ho etsa ponahalo ea popover u sebelisa mefuta e fapaneng ea CSS . Re theha sehlopha sa tloaelo data-bs-custom-class="custom-popover"
ho lekanya ponahalo ea rona ea tloaelo le ho e sebelisa ho feta tse ling tsa mefuta ea CSS ea lehae.
.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>
Tlosa ho tobetsa e latelang
Sebelisa focus
seqhutsu ho leleka li-popovers ha mosebelisi a tobetsa ntho e latelang e fapaneng le ea toggle element.
Ho hlokahala letšoao le ikhethileng bakeng sa ho penya-ha-e latelang
Bakeng sa boits'oaro bo nepahetseng ba sebatli le sethala, o tlameha ho sebelisa tag <a>
, eseng<button>
tag, hape o tlameha ho kenyelletsa tabindex
tšobotsi.
<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'
})
Lintho tse holofetseng
Lintho tse nang le disabled
tšobotsi ha li sebelisane, ho bolelang hore basebelisi ba ke ke ba li sutumelletsa kapa ba li tobetse ho etsa hore popover (kapa tooltip). Joalo ka mokhoa oa ho sebetsa, o tla batla ho tsosa popover ho tsoa ho sephutheloana <div>
kapa <span>
, e etselitsoeng hore keyboard e tsepamise maikutlo ho sebelisoa tabindex="0"
.
Bakeng sa li-triggers tsa popover tse nang le bokooa, u kanna ua khetha data-bs-trigger="hover focus"
hore popover e hlahe e le maikutlo a hanghang ho basebelisi ba hau kaha ba kanna ba se lebelle ho tobetsa ntho e holofetseng.
<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
Lintho tse fapaneng
E kentsoe ho v5.2.0E le karolo ea mokhoa oa ho fetoha oa CSS oa Bootstrap, popovers joale ba sebelisa mefuta-futa ea CSS ea lehae .popover
bakeng sa ho ntlafatsa nako ea sebele. Litekanyetso tsa mefuta-futa ea CSS li behiloe ka Sass, kahoo mokhoa oa Sass o ntse o tšehetsoa, le oona.
--#{$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);
Mefuta e fapaneng ea 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;
Tšebeliso
Lumella li-popover ka JavaScript:
const exampleEl = document.getElementById('example')
const popover = new bootstrap.Popover(exampleEl, options)
Ho etsa hore popover e sebetse bakeng sa basebelisi ba keyboard le theknoloji e thusang
Ho lumella basebelisi ba keyboard ho kenya li-popovers tsa hau, u lokela ho li kenya feela ho likarolo tsa HTML tseo ka tloaelo li shebaneng le keyboard le ho sebelisana (joalo ka likhokahano kapa taolo ea foromo). Leha likarolo tsa HTML (tse kang <span>
s) li ka tsepamisoa maikutlo ka ho eketsa tabindex="0"
tšobotsi, sena se tla eketsa li-tab tse ka khopisang le tse ferekanyang linthong tse sa sebetseng bakeng sa basebelisi ba keyboard, 'me mahlale a mangata a thusang hajoale ha a phatlalatse litaba tsa popover maemong ana. . Ho phaella moo, u se ke ua itšetleha feela ka hover
hore ke mohloli oa li-popovers tsa hau, kaha sena se tla etsa hore ho se khonehe ho qalisa basebelisi ba keyboard.
Leha o ka kenya HTML e ruileng, e hlophisitsoeng ka har'a popover ka html
khetho, re khothaletsa ka matla hore u qobe ho eketsa bongata bo bongata ba litaba. Tsela eo popovers e sebetsang ka eona hajoale ke hore, hang ha e se e bonts'itsoe, litaba tsa bona li hokahane le ntho e qalang ka aria-describedby
semelo. Ka lebaka leo, litaba tsa popover kaofela li tla phatlalatsoa ho basebelisi ba theknoloji e thusang e le molatsoana o le mong o molelele o sa sitisoeng.
Ho feta moo, leha ho ka khoneha ho kenyelletsa li-control tse sebetsanang (joalo ka likarolo tsa sebopeho kapa likhokahano) ho popover ea hau (ka ho kenyelletsa lintlha tsena ho allowList
litšoaneleho le li-tag tse lumelletsoeng), hlokomela hore hajoale popover ha e laole tatellano ea ho tsepamisa maikutlo ho keyboard. Ha mosebelisi oa keyboard a bula popover, ho tsepamisitsoe maikutlo ho ntho e qalang, 'me joalo ka ha popover hangata e sa latele sesosa hanghang sebopehong sa tokomane, ha ho na tiiso ea hore ho ea pele/ho hatella.TABe tla tsamaisa mosebelisi oa keyboard ho popover ka boeona. Ka bokhuts'oane, ho kenya li-control tse sebetsang ho popover ho ka etsa hore litsamaiso tsena li se fumanehe / li se ke tsa sebelisoa bakeng sa basebelisi ba keyboard le basebelisi ba mahlale a thusang, kapa bonyane ho etsa tatellano e sa utloahaleng ea ho tsepamisa maikutlo. Maemong ana, nahana ka ho sebelisa modal dialog ho e-na le hoo.
Dikgetho
Kaha likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript, u ka kenyelletsa lebitso la khetho ho data-bs-
, joalo ka data-bs-animation="{value}"
. Etsa bonnete ba hore o fetola mofuta oa nyeoe ea lebitso la khetho ho tloha " camelCase "ho " kebab-case " ha o fetisa likhetho ka litšobotsi tsa data. Ka mohlala, sebelisa data-bs-custom-class="beautifier"
ho e-na le data-bs-customClass="beautifier"
.
Ho tloha ka Bootstrap 5.2.0, likarolo tsohle li ts'ehetsa tlhahlobo ea data e bolokiloeng data-bs-config
e ka bolokang tlhophiso e bonolo ea karolo joalo ka khoele ea JSON. Ha element e na data-bs-config='{"delay":0, "title":123}'
le data-bs-title="456"
litšoaneleho, boleng ba ho qetela title
bo tla ba 456
'me lintlha tse arohaneng tsa data li tla feta boleng bo fanoeng ho data-bs-config
. Ntle le moo, litšoaneleho tse teng tsa data li khona ho boloka boleng ba JSON joalo ka data-bs-delay='{"show":0,"hide":150}'
.
sanitize
,
sanitizeFn
, le
allowList
likhetho li ke ke tsa fanoa ho sebelisoa litšobotsi tsa data.
Lebitso | Mofuta | Ea kamehla | Tlhaloso |
---|---|---|---|
allowList |
ntho | Boleng ba kamehla | Ntho e nang le litšobotsi le li-tag tse lumelletsoeng. |
animation |
boolean | true |
Kenya phetoho ea CSS fade ho popover. |
boundary |
khoele, element | 'clippingParents' |
Moeli o thibelang ho phalla ha metsi (o sebetsa feela ho Popper's preventOverflow modifier). Ka mokhoa o ikhethileng, ke ' 'clippingParents' me e ka amohela tšupiso ea HTMLElement (ka JavaScript feela). Ho fumana lintlha tse ling, sheba ho Popper's detectOverflow docs . |
container |
khoele, element, bohata | false |
E eketsa popover ho element e itseng. Mohlala container: 'body' :. Khetho ena e bohlokoa haholo hobane e u lumella ho beha popover phallong ea tokomane haufi le ntho e qalang - e tla thibela popover hore e se ke ea phaphamala hole le ntho e bakang nakong ea ho fetola boholo ba fensetere. |
content |
khoele, element, mosebetsi | '' |
Boleng ba litaba bo ka rekoang haeba data-bs-content semelo se le sieo. Haeba ts'ebetso e fanoe, e tla bitsoa ka this litšupiso tsa eona ho element eo popover e khomaretsoeng ho eona. |
customClass |
khoele, mosebetsi | '' |
Kenya litlelase ho popover ha e bontšoa. Hlokomela hore litlelase tsena li tla eketsoa ho kenyelletsa litlelase life kapa life tse boletsoeng template. Ho eketsa lihlopha tse ngata, li arole ka libaka: 'class-1 class-2' . U ka fetisa tšebetso e lokelang ho khutlisa khoele e le 'ngoe e nang le mabitso a sehlopha sa tlatsetso. |
delay |
palo, ntho | 0 |
Ho lieha ho hlahisa le ho pata popover (ms)—ha e sebetse mofuteng oa ho kenya letsoho. Haeba nomoro e fanoe, ho lieha ho sebelisoa ho pata/show ka bobeli. delay: { "show": 500, "hide": 100 } Sebopeho sa ntho ke:. |
fallbackPlacements |
khoele, sehlopha | ['top', 'right', 'bottom', 'left'] |
Hlalosa lipehelo tsa morao-rao ka ho fana ka lethathamo la libaka tse behiloeng ka tatellano (ho ea ka khetho). Ho fumana lintlha tse ling, sheba ho Popper's behaviour docs . |
html |
boolean | false |
Lumella HTML ho popover. Haeba ke 'nete, li-tag tsa HTML ho popover's title li tla hlahisoa ho popover. Haeba e le leshano, innerText thepa e tla sebelisoa ho kenya litaba ho DOM. Sebelisa mongolo haeba u tšoenyehile ka litlhaselo tsa XSS. |
offset |
palo, khoele, mosebetsi | [0, 0] |
Phetoho ea popon e ipapisitse le sepheo sa eona. O ka fetisa khoele ho litšobotsi tsa data tse nang le boleng bo arohaneng ba comma joalo ka: data-bs-offset="10,20" . Ha ts'ebetso e sebelisoa ho fumana qeto, e bitsoa ka ntho e nang le popper placement, reference, le popper rects e le khang ea eona ea pele. The triggering element DOM node e fetisitsoe e le khang ea bobeli. Mosebetsi o tlameha ho khutlisa sehlopha se nang le linomoro tse peli: skidding , distance . Ho fumana lintlha tse ling, sheba ho Popper's offset docs . |
placement |
khoele, mosebetsi | 'top' |
Mokhoa oa ho beha popover: auto, holimo, tlase, ka ho le letšehali, ka ho le letona. Ha auto e hlalositsoe, e tla fetola popover ka mokhoa o matla. Ha ts'ebetso e sebelisoa ho fumana sebaka sa ho beoa, e bitsoa le node ea popover DOM e le khang ea eona ea pele le ntho e qalang ea DOM node e le ea bobeli. Boemo this bo behiloe ho mohlala oa popover. |
popperConfig |
lefeela, ntho, tshebetso | null |
Ho fetola tlhophiso ea kamehla ea Bootstrap ea Popper, bona tlhophiso ea Popper . Ha ts'ebetso e sebelisoa ho theha tlhophiso ea Popper, e bitsoa ka ntho e nang le tlhophiso ea kamehla ea Bootstrap ea Popper. E u thusa ho sebelisa le ho kopanya ea kamehla le tlhophiso ea hau. Ts'ebetso e tlameha ho khutlisa ntho e hlophisitsoeng bakeng sa Popper. |
sanitize |
boolean | true |
Lumella kapa u tima tsamaiso ea sanitization. Haeba e kentsoe 'template' , 'content' 'me 'title' likhetho li tla hloekisoa. |
sanitizeFn |
null, tshebetso | null |
Mona o ka fana ka ts'ebetso ea hau ea sanitize. Sena se ka ba molemo haeba u khetha ho sebelisa laebrari e inehetseng ho etsa bohloeki. |
selector |
khoele, bohata | false |
Haeba ho fanoe ka khetho, lintho tsa popover li tla abeloa ho sepheo se boletsoeng. Ha e le hantle, sena se sebelisetsoa ho sebelisa li-popovers ho likarolo tsa DOM tse ekelitsoeng ka matla ( jQuery.on ts'ehetso). Sheba taba ena le mohlala o rutang . |
template |
khoele | '<div class="popover" role="popover"><div class="popover-arrow"></div><div class="popover-inner"></div></div>' |
HTML ea mantlha eo u ka e sebelisang ha u theha popover. Li-popover li title tla kenngoa ka har'a .popover-inner . .popover-arrow e tla fetoha motsu oa popover. Karolo e ka ntle ea wrapper e lokela ho ba le .popover sehlopha le role="popover" . |
title |
khoele, element, mosebetsi | '' |
Boleng ba sehlooho sa kamehla haeba title semelo se le sieo. Haeba ts'ebetso e fanoe, e tla bitsoa ka this litšupiso tsa eona ho element eo popover e khomaretsoeng ho eona. |
trigger |
khoele | 'hover focus' |
Popover e qala joang: tobetsa, hover, tsepamisa maikutlo, tataiso. U ka 'na ua fetisa li-triggers tse ngata; di arole ka sebaka. 'manual' e bonts'a hore popover e tla hlahisoa ka mokhoa oa lenaneo ka .popover('show') , .popover('hide') le .popover('toggle') mekhoa; boleng bona bo ke ke ba kopanngoa le sesosa leha e le sefe se seng. 'hover' ka botsona ho tla fella ka li-popovers tse ke keng tsa hlahisoa ka keyboard, 'me li lokela ho sebelisoa feela haeba mekhoa e meng ea ho fetisa tlhahisoleseling e tšoanang bakeng sa basebelisi ba keyboard e le teng. |
Litšobotsi tsa data bakeng sa li-popovers ka bomong
Likhetho bakeng sa li-popovers ka bomong li ka hlalosoa ka tšebeliso ea litšobotsi tsa data, joalo ka ha ho hlalositsoe ka holimo.
Ho sebelisa ts'ebetso lepopperConfig
const popover = new bootstrap.Popover(element, {
popperConfig(defaultBsPopperConfig) {
// const newPopperConfig = {...}
// use defaultBsPopperConfig if needed...
// return newPopperConfig
}
})
Mekhoa
Mekhoa ea Asynchronous le liphetoho
Mekhoa eohle ea API ha e- synchronous 'me e qala phetoho . Ba khutlela ho motho ea letselitseng hang ha phetoho e qala empa pele e fela . Ho feta moo, mohala oa mokhoa ho karolo ea phetoho o tla hlokomolohuoa .
Sheba litokomane tsa rona tsa JavaScript bakeng sa lintlha tse ling .
Mokhoa | Tlhaloso |
---|---|
disable |
E tlosa bokhoni ba ho hlahisa popover ea element. Popover e tla bonts'oa feela ha e buletsoe hape. |
dispose |
E pata le ho senya popover ea element (E tlosa data e bolokiloeng ho element ea DOM). Li-Popovers tse sebelisang moifo (tse entsoeng ho sebelisoa khetho selector ) li ke ke tsa senngoa ka bonngoe ho latela likarolo tse qalang. |
enable |
E fa element's popover bokhoni ba ho bonts'a. Li-Popovers li lumelloa ka mokhoa oa kamehla. |
getInstance |
Mokhoa o tsitsitseng o u lumellang ho fumana mohlala oa popover o amanang le ntho ea DOM. |
getOrCreateInstance |
Mokhoa o tsitsitseng o o lumellang ho fumana mohlala oa popover o amanang le element ea DOM, kapa u thehe e ncha haeba e sa qalisoa. |
hide |
E pata popo ea lintho. E khutlela ho ea letselitseng pele popover e patiloe (ke hore pele hidden.bs.popover ketsahalo e etsahala). Sena se nkuoa e le "manual" e tsosang popo. |
setContent |
E fana ka mokhoa oa ho fetola litaba tsa popover kamora ho qala. |
show |
E hlahisa poover ea element. E khutlela ho ea letselitseng pele popover e bonts'oa (ke hore pele shown.bs.popover ketsahalo e etsahala). Sena se nkuoa e le "manual" e tsosang popo. Li-Popovers tseo sehlooho le litaba tsa tsona li leng bolelele ba lefela ha ho mohla li hlahisoang. |
toggle |
E fetola popover ea element. E khutlela ho ea letselitseng pele popover e bonts'oa kapa e patiloe (ke hore pele ketsahalo shown.bs.popover kapa hidden.bs.popover ketsahalo e etsahala). Sena se nkuoa e le "manual" e tsosang popo. |
toggleEnabled |
E fetola bokhoni ba popover ea element hore e bontšoe kapa e patehe. |
update |
E kaonefatsa boemo ba elemente popover. |
// 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
o amohela
object
khang, moo senotlolo se seng le se seng sa thepa e leng
string
mokhethoa ea nepahetseng ka har'a template ea popover, 'me boleng bo bong le bo bong bo amanang le thepa e ka ba
string
|
element
|
function
|
null
Liketsahalo
Ketsahalo | Tlhaloso |
---|---|
hide.bs.popover |
Ketsahalo ena e lelekoa hang hang ha hide mokhoa oa mohlala o bitsoa. |
hidden.bs.popover |
Ketsahalo ena e ts'oaroa ha popover e qetile ho patoa ho mosebelisi (e tla emela hore liphetoho tsa CSS li phethehe). |
inserted.bs.popover |
Ketsahalo ena e lelekoa kamora show.bs.popover ketsahalo ea ha template ea popover e kentsoe ho DOM. |
show.bs.popover |
Ketsahalo ena e tuka hang hang ha show mokhoa oa mohlala o bitsoa. |
shown.bs.popover |
Ketsahalo ena e lelekoa ha popover e se e bonahala ho mosebelisi (e tla emela hore liphetoho tsa CSS li phethehe). |
const myPopoverTrigger = document.getElementById('myPopover')
myPopoverTrigger.addEventListener('hidden.bs.popover', () => {
// do something...
})