Popovers
Nā palapala a me nā laʻana no ka hoʻohui ʻana i nā popovers Bootstrap, e like me nā mea i loaʻa ma iOS, i kekahi mea ma kāu pūnaewele.
Nānā nui
Nā mea e ʻike ai i ka hoʻohana ʻana i ka popover plugin:
- Ke hilinaʻi nei nā Popovers i ka waihona waihona ʻaoʻao ʻekolu ʻo Popper no ke kūlana. Pono ʻoe e hoʻokomo i ka popper.min.js ma mua
bootstrap.js
, a i ʻole e hoʻohana i kekahibootstrap.bundle.min.js
i loaʻa iā Popper. - Pono nā Popovers i ka popover plugin ma ke ʻano he hilinaʻi.
- Hoʻokomo ʻia nā Popovers no nā kumu hana, no laila pono ʻoe e hoʻomaka iā lākou iho .
- ʻAʻole loa e hōʻike ʻia kahi popover ka lōʻihi ʻole
title
a me nā waiwai.content
- E wehewehe
container: 'body'
i mea e pale aku ai i nā pilikia i loko o nā ʻāpana paʻakikī (e like me kā mākou pūʻulu hoʻokomo, pūʻulu pihi, a pēlā aku). - ʻAʻole e holo ka hoʻoulu ʻana i nā popovers ma nā mea huna.
- Pono e ho'āla ʻia nā popovers no a i
.disabled
ʻoledisabled
nā mea ʻeleʻele ma luna o kahi mea ʻōwili. - Ke hoʻāla ʻia mai nā heleuma e ʻōwili i nā laina he nui, e kau ʻia nā popovers ma waena o ka laula holoʻokoʻa o nā heleuma. E hoʻohana
.text-nowrap
i kāu<a>
s e pale i kēia ʻano. - Pono e hūnā ʻia nā popover ma mua o ka wehe ʻia ʻana o kā lākou mau mea pili mai ka DOM.
- Hiki ke hoʻoulu ʻia nā popovers i kahi mea i loko o kahi DOM shadow.
prefers-reduced-motion
nīnau media. E ʻike
i ka ʻāpana hoʻohaʻahaʻa o kā mākou palapala hiki ke komo .
E hoʻomau i ka heluhelu e ʻike i ka hana ʻana o nā popovers me kekahi mau laʻana.
Nā laʻana
E ho'ā i nā popovers
E like me ka mea i ʻōlelo ʻia ma luna, pono ʻoe e hoʻomaka i nā popovers ma mua o ka hiki ke hoʻohana ʻia. ʻO kahi ala e hoʻomaka ai i nā popovers a pau ma kahi ʻaoʻao, ʻo ia ke koho ʻana iā lākou e ko lākou data-bs-toggle
ʻano, e like me:
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
Demo ola
Hoʻohana mākou i ka JavaScript e like me ka snippet ma luna aʻe e hāʻawi i ka popover ola aʻe. Hoʻonohonoho ʻia nā poʻo inoa ma o data-bs-title
a hoʻonohonoho ʻia ka ʻike kino ma o data-bs-content
.
title
a
i ʻole. data-bs-title
Ke
title
hoʻohana ʻia, e hoʻololi ʻo Popper iā ia me ka
data-bs-title
wā e hāʻawi ʻia ai ka mea.
<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>
ʻEhā kuhikuhi
Loaʻa nā koho ʻehā: luna, ʻākau, lalo, a hema. Hoʻohālikelike ʻia nā kuhikuhi i ka wā e hoʻohana ai iā Bootstrap ma RTL. Hoʻonohonoho data-bs-placement
e hoʻololi i ke ala.
<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>
Kuʻunacontainer
Ke loaʻa iā ʻoe kekahi mau kaila ma kahi mea makua e hoʻopilikia i kahi popover, makemake ʻoe e kuhikuhi i kahi maʻamau container
i ʻike ʻia ka HTML o ka popover i loko o ia mea. He mea maʻamau kēia i nā papa pane, nā hui hoʻokomo, a me nā mea like.
const popover = new bootstrap.Popover('.example-popover', {
container: 'body'
})
ʻO kahi kūlana ʻē aʻe kahi āu e makemake ai e hoʻonohonoho i kahi kuʻuna maʻamau container
ʻo ia nā popovers i loko o kahi kamaʻilio modal , e ʻike pono ua hoʻopili ʻia ka popover ponoʻī i ka modal. He mea koʻikoʻi kēia no nā popover i loaʻa nā mea pili - e pahele nā kamaʻilio modal i ka manaʻo, no laila inā ʻaʻole he mea keiki ka popover o ka modal, ʻaʻole hiki i nā mea hoʻohana ke kālele a hoʻāla paha i kēia mau mea pili.
const popover = new bootstrap.Popover('.example-popover', {
container: '.modal-body'
})
Nā popovers maʻamau
Hoʻohui ʻia ma v5.2.0Hiki iā ʻoe ke hana i ke ʻano o nā popovers me ka hoʻohana ʻana i nā ʻano CSS . Hoʻonohonoho mākou i kahi papa maʻamau me data-bs-custom-class="custom-popover"
ka hoʻopili ʻana i kā mākou hiʻohiʻona maʻamau a hoʻohana iā ia e hoʻopau i kekahi o nā ʻano CSS kūloko.
.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>
Hoʻokuʻu i ke kaomi aʻe
E hoʻohana i ke focus
kumu no ka hoʻokuʻu ʻana i nā popovers ma ke kaomi aʻe a ka mea hoʻohana i kekahi mea ʻokoʻa ma mua o ka mea hoʻololi.
Pono ka māka kikoʻī no ka hoʻokuʻu ʻana ma ka kaomi aʻe
No ka hoʻohana ʻana i ka <a>
lepili, ʻaʻole ka <button>
tag, a pono ʻoe e hoʻokomo i kahi tabindex
ʻano.
<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'
})
Nā mea hoʻopale
ʻAʻole pili nā mea me ka disabled
hiʻohiʻona, ʻo ia hoʻi, ʻaʻole hiki i nā mea hoʻohana ke hoʻoluli a kaomi paha iā lākou no ka hoʻomaka ʻana i kahi popover (a i ʻole tooltip). Ma ke ʻano he hana hoʻoponopono, makemake ʻoe e hoʻomaka i ka popover mai kahi wīwī a i <div>
ʻole <span>
, i hana maikaʻi ʻia i ka keyboard-focusable me ka hoʻohana ʻana i tabindex="0"
.
No nā mea hoʻomaka popover kīnā ʻole, makemake paha ʻoe i data-bs-trigger="hover focus"
ʻike ʻia ka popover ma ke ʻano he manaʻo ʻike koke i kāu mea hoʻohana no ka mea ʻaʻole lākou e manaʻo e kaomi i kahi mea kīnā.
<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
Nā mea hoʻololi
Hoʻohui ʻia ma v5.2.0Ma ke ʻano o ka hoʻokokoke ʻana o nā ʻano hoʻololi CSS e ulu ana a Bootstrap, ua hoʻohana nā popovers i nā ʻano CSS kūloko .popover
no ka hoʻomaikaʻi ʻana i ka manawa maoli. Hoʻonohonoho ʻia nā waiwai no nā ʻano CSS ma o Sass, no laila ke kākoʻo mau ʻia nei ka hana maʻamau Sass.
--#{$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);
Nā hoʻololi 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;
Hoʻohana
E ho'ā i nā popovers ma o JavaScript:
const exampleEl = document.getElementById('example')
const popover = new bootstrap.Popover(exampleEl, options)
Hana ʻia nā popovers no nā mea hoʻohana ʻenehana kōkua
No ka ʻae ʻana i nā mea hoʻohana kīpē e hoʻāla i kāu mau popovers, pono ʻoe e hoʻohui iā lākou i nā mea HTML i maʻa mau i ka keyboard-focusable a me ka launa pū ʻana (e like me nā loulou a i ʻole nā mana hoʻoponopono). ʻOiai hiki ke hoʻopaʻa ʻia nā mea HTML ʻokoʻa (e like me <span>
s) ma o ka hoʻohui ʻana i ke ʻano tabindex="0"
, e hoʻohui kēia i nā pahu hoʻonāukiuki a huikau i nā mea pili ʻole no nā mea hoʻohana keyboard, a ʻo ka hapa nui o nā ʻenehana kōkua i kēia manawa ʻaʻole hoʻolaha i ka ʻike o ka popover i kēia kūlana. . Eia hou, mai hilinaʻi wale ma hover
ke ʻano he kumu no kāu popovers, no ka mea e hiki ʻole ai iā lākou ke hoʻomaka no nā mea hoʻohana keyboard.
ʻOiai hiki iā ʻoe ke hoʻokomo i ka HTML waiwai, kūkulu ʻia i loko o nā popovers me ke html
koho, makemake mākou e hōʻole ʻoe i ka hoʻohui ʻana i ka nui o ka ʻike. ʻO ke ʻano o ka hana ʻana o nā popovers i kēia manawa, i ka manawa i hōʻike ʻia, pili ʻia kā lākou ʻike i ka mea hoʻoulu me ka aria-describedby
ʻano. ʻO ka hopena, e hoʻolaha ʻia ka ʻike holoʻokoʻa o ka popover i nā mea hoʻohana ʻenehana kōkua ma ke ʻano he kahawai lōʻihi ʻole.
Eia kekahi, ʻoiai hiki ke hoʻokomo pū i nā mana pāʻani (e like me nā ʻano kumu a i ʻole nā loulou) i kāu popover (ma ka hoʻohui ʻana i kēia mau mea i nā ʻano allowList
a me nā hōʻailona i ʻae ʻia), e hoʻomaopopo ʻoe ʻaʻole e hoʻokele ka popover i kēia manawa i ka papa kuhikuhi. Ke wehe ka mea hoʻohana keyboard i kahi popover, e kau ka manaʻo ma ka mea hoʻāla, a no ka mea, ʻaʻole e hahai koke ka popover i ke kumu o ka palapala, ʻaʻohe mea e hōʻoiaʻiʻo e neʻe i mua / kaomi.TABe hoʻoneʻe i kahi mea hoʻohana keyboard i loko o ka popover ponoʻī. I ka pōkole, ʻo ka hoʻohui wale ʻana i nā mana interactive i kahi popover e hiki ʻole ai ke hoʻohana ʻia kēia mau mana no nā mea hoʻohana keyboard a me nā mea hoʻohana i nā ʻenehana kōkua, a i ʻole ka mea liʻiliʻi loa e hana i kahi kauoha kikoʻī holoʻokoʻa. I kēia mau hihia, e noʻonoʻo e hoʻohana i kahi kamaʻilio modal.
Nā koho
Hiki ke hāʻawi ʻia nā koho ma o nā ʻikepili a i ʻole JavaScript, hiki iā ʻoe ke hoʻohui i kahi inoa koho i data-bs-
, e like me ka data-bs-animation="{value}"
. E hōʻoia e hoʻololi i ke ʻano hihia o ka inoa koho mai " CamelCase " i " kebab-case " i ka wā e hāʻawi ai i nā koho ma o nā ʻano ʻikepili. No ka laʻana, hoʻohana data-bs-custom-class="beautifier"
ma kahi o data-bs-customClass="beautifier"
.
E like me Bootstrap 5.2.0, kākoʻo nā ʻāpana āpau i kahi hiʻohiʻona ʻikepili i mālama ʻiadata-bs-config
i hiki ke mālama i ka hoʻonohonoho ʻāpana maʻalahi ma ke ʻano he kaula JSON. Ke loaʻa nā ʻano mea data-bs-config='{"delay":0, "title":123}'
a me data-bs-title="456"
nā ʻano, ʻo ka title
waiwai hope loa 456
a na nā ʻano ʻikepili kaʻawale e kāpae i nā waiwai i hāʻawi ʻia ma data-bs-config
. Eia kekahi, hiki i nā ʻikepili ʻikepili ke hoʻopaʻa i nā waiwai JSON e like me data-bs-delay='{"show":0,"hide":150}'
.
sanitize
E hoʻomanaʻo ʻaʻole hiki ke hāʻawi ʻia nā ,
sanitizeFn
, a me
nā koho
no nā kumu palekana
allowList
me ka hoʻohana ʻana i nā ʻano ʻikepili.
inoa | ʻAno | Default | wehewehe |
---|---|---|---|
allowList |
mea | Waiwai paʻamau | He mea i ʻae ʻia nā ʻano a me nā hōʻailona. |
animation |
boolean | true |
E noi i kahi hoʻololi fade CSS i ka popover. |
boundary |
kaula, ʻeleʻele | 'clippingParents' |
ʻO ka palena palena o ka popover (pili wale i ka mea hoʻololi hoʻololi a Popper preventOverflow). Ma ka paʻamau, hiki iā ia 'clippingParents' ke ʻae i kahi kuhikuhi HTMLElement (ma JavaScript wale nō). No ka ʻike hou aku e nānā i nā palapala detectOverflow a Popper . |
container |
kaula, ʻeleʻele, wahaheʻe | false |
Hoʻopili i ka popover i kahi mea kikoʻī. Laʻana: container: 'body' . He mea maikaʻi loa kēia koho no ka mea hiki iā ʻoe ke hoʻonoho i ka popover i ke kahe o ka palapala ma kahi o ka mea hoʻāla - e pale aku i ka popover mai ka lana ʻana mai ka mea hoʻāla i ka wā e hoʻololi ai ka puka makani. |
content |
kaula, mea, hana | '' |
Waiwai maʻiʻo paʻamau inā data-bs-content ʻaʻole i loaʻa ke ʻano. Inā hāʻawi ʻia kahi hana, e kāhea ʻia me kāna this kuhikuhi i hoʻonohonoho ʻia i ka mea i hoʻopili ʻia ka popover. |
customClass |
kaula, hana | '' |
Hoʻohui i nā papa i ka popover ke hōʻike ʻia. E hoʻomaopopo e hoʻohui ʻia kēia mau papa i nā papa i kuhikuhi ʻia i loko o ka template. No ka hoʻohui ʻana i nā papa he nui, e hoʻokaʻawale iā lākou me nā hakahaka: 'class-1 class-2' . Hiki iā ʻoe ke hāʻawi i kahi hana e hoʻihoʻi i kahi kaula hoʻokahi i loaʻa nā inoa papa hou. |
delay |
helu, mea | 0 |
Hoʻopaneʻe i ka hōʻike ʻana a huna ʻana i ka popover (ms)—ʻaʻole pili i ke ʻano hoʻoiho lima. Inā hāʻawi ʻia kahi helu, hoʻopili ʻia ka lohi i ka huna/hōʻike ʻelua. ʻO ka hoʻolālā mea: delay: { "show": 500, "hide": 100 } . |
fallbackPlacements |
kaulaʻi, ʻaʻahu | ['top', 'right', 'bottom', 'left'] |
E wehewehe i nā wahi hāʻule hope ma ka hāʻawi ʻana i kahi papa inoa o nā wahi i ka laha (e like me ka makemake). No ka ʻike hou aku, e nānā i nā palapala hana a Popper . |
html |
boolean | false |
E ʻae iā HTML ma ka popover. Inā ʻoiaʻiʻo, e hāʻawi ʻia nā huaʻōlelo HTML ma ka popover title i ka popover. Inā hewa, innerText e hoʻohana ʻia ka waiwai e hoʻokomo i ka ʻike i loko o ka DOM. E hoʻohana i ka kikokikona inā hopohopo ʻoe e pili ana i ka hoʻouka kaua XSS. |
offset |
helu, kaula, hana | [0, 0] |
Offset o ka popover e pili ana i kona pahu hopu. Hiki iā ʻoe ke hāʻawi i kahi kaula i nā ʻano ʻikepili me nā koma i hoʻokaʻawale ʻia e like me: data-bs-offset="10,20" . Ke hoʻohana ʻia kahi hana no ka hoʻoholo ʻana i ka offset, ua kapa ʻia ia me kahi mea i loaʻa ka popper placement, ka kuhikuhi, a me ka popper rects e like me kāna hoʻopaʻapaʻa mua. Hoʻoholo ʻia ka mea hoʻomaka DOM node ma ke ʻano he pane ʻelua. Pono ka hana e hoʻihoʻi i kahi lae me nā helu ʻelua: skidding , distance . No ka ʻike hou aku, e nānā i nā palapala offset a Popper . |
placement |
kaula, hana | 'top' |
Pehea e hoʻonoho ai i ka popover: auto, luna, lalo, hema, ʻākau. Ke auto kuhikuhi ʻia, e hoʻohuli hou ia i ka popover. Ke hoʻohana ʻia kahi hana no ka hoʻoholo ʻana i ka hoʻokomo ʻana, ua kapa ʻia ʻo ia me ka popover DOM node ma ke ʻano he kumu hoʻopaʻapaʻa mua a ʻo ka mea hoʻomaka DOM node ʻo ia ka lua. Hoʻonohonoho ʻia ka this pōʻaiapili i ka laʻana popover. |
popperConfig |
null, mea, hana | null |
No ka hoʻololi i ka hoʻonohonoho Popper paʻamau o Bootstrap, e ʻike i ka hoʻonohonoho ʻana o Popper . Ke hoʻohana ʻia kahi hana no ka hana ʻana i ka hoʻonohonoho Popper, kāhea ʻia me kahi mea i loaʻa ka hoʻonohonoho Popper paʻamau o Bootstrap. Kōkua ia iā ʻoe e hoʻohana a hoʻohui i ka paʻamau me kāu hoʻonohonoho ponoʻī. Pono e hoʻihoʻi ka hana i kahi mea hoʻonohonoho no Popper. |
sanitize |
boolean | true |
E ho'ā a hoʻopau paha i ka hoʻomaʻemaʻe. Inā ho'āla ʻia 'template' , 'content' a 'title' e hoʻomaʻemaʻe ʻia nā koho. |
sanitizeFn |
null, hana | null |
Maanei hiki iā ʻoe ke hoʻolako i kāu hana hoʻomaʻemaʻe ponoʻī. Hiki ke kōkua inā makemake ʻoe e hoʻohana i kahi waihona i hoʻolaʻa ʻia e hana i ka hoʻomaʻemaʻe. |
selector |
kaula, wahahee | false |
Inā hāʻawi ʻia kahi mea koho, e hāʻawi ʻia nā mea popover i nā pahuhopu i kuhikuhi ʻia. Ma ka hoʻomaʻamaʻa, hoʻohana ʻia kēia no ka hoʻopili ʻana i nā popovers i nā mea DOM i hoʻohui pū ʻia ( jQuery.on kākoʻo). E ʻike i kēia pilikia a me kahi laʻana ʻike . |
template |
kaulahao | '<div class="popover" role="popover"><div class="popover-arrow"></div><div class="popover-inner"></div></div>' |
Base HTML e hoʻohana i ka hana ʻana i ka popover. E hoʻokomo ʻia ka popover i title loko o ka .popover-inner . .popover-arrow e lilo i ka pua popover. Pono e loa'a ka .popover papa a me ka role="popover" . |
title |
kaula, mea, hana | '' |
Waiwai poʻo inoa paʻamau inā title ʻaʻole i loaʻa ke ʻano. Inā hāʻawi ʻia kahi hana, e kāhea ʻia me kāna this kuhikuhi i hoʻonohonoho ʻia i ka mea i hoʻopili ʻia ka popover. |
trigger |
kaulahao | 'hover focus' |
Pehea e hoʻomaka ai ka popover: kaomi, hover, focus, manual. Hiki iā ʻoe ke hāʻawi i nā kumu he nui; e hoʻokaʻawale iā lākou me kahi ākea. 'manual' e hōʻike ana e hoʻomaka ʻia ka popover ma ka papahana ma o ka .popover('show') , .popover('hide') a me .popover('toggle') nā ala; ʻAʻole hiki ke hoʻohui ʻia kēia waiwai me nā kumu ʻē aʻe. 'hover' ʻO ia ka hopena i nā popovers ʻaʻole hiki ke hoʻoulu ʻia ma o ka papa keyboard, a pono e hoʻohana ʻia inā aia nā ala ʻē aʻe no ka lawe ʻana i ka ʻike like no nā mea hoʻohana keyboard. |
Nā hiʻohiʻona ʻikepili no nā popovers pākahi
Hiki ke koho ʻia nā koho no nā popovers pākahi ma o ka hoʻohana ʻana i nā ʻano ʻikepili, e like me ka wehewehe ʻana ma luna.
Ke hoʻohana nei i ka hana mepopperConfig
const popover = new bootstrap.Popover(element, {
popperConfig(defaultBsPopperConfig) {
// const newPopperConfig = {...}
// use defaultBsPopperConfig if needed...
// return newPopperConfig
}
})
Nā ʻano hana
Nā ʻano asynchronous a me nā hoʻololi
Asynchronous nā ala API āpau a hoʻomaka i kahi hoʻololi . Hoʻi lākou i ka mea kelepona i ka wā e hoʻomaka ai ka hoʻololi akā ma mua o ka pau ʻana . Eia kekahi, e nānā ʻole ʻia kahi ala e kāhea ai i kahi mea hoʻololi .
Kaʻina hana | wehewehe |
---|---|
disable |
Wehe i ka hiki ke hōʻike ʻia ka popover o kahi mea. Hiki ke hōʻike ʻia ka popover inā hoʻā hou ʻia. |
dispose |
Hūnā a hoʻopau i ka popover o kahi mea (Wehe i ka ʻikepili i mālama ʻia ma ka mea DOM). ʻAʻole hiki ke hoʻopau pākahi ʻia nā popovers e hoʻohana ana i ka ʻelele (i hana ʻia me ka hoʻohana ʻana i ke selector koho ). |
enable |
Hāʻawi i ka popover o kahi mea i hiki ke hōʻike ʻia. Hoʻohana ʻia nā Popovers ma ka paʻamau. |
getInstance |
ʻO ke ala static e hiki ai iā ʻoe ke kiʻi i ka mea popover e pili ana me kahi mea DOM. |
getOrCreateInstance |
ʻO ke ʻano static e hiki ai iā ʻoe ke kiʻi i ka popover e pili ana me kahi mea DOM, a i ʻole e hana i kahi mea hou inā ʻaʻole i hoʻomaka ʻia. |
hide |
Hūnā i ka popover o kekahi mea. Hoʻi i ka mea kelepona ma mua o ka hūnā ʻia ʻana o ka popover (ʻo ia hoʻi ma mua o ka hiki ʻana o ka hidden.bs.popover hanana). Manaʻo ʻia kēia he "manual" triggering o ka popover. |
setContent |
Hāʻawi i kahi ala e hoʻololi ai i ka ʻikepili o ka popover ma hope o kona hoʻomaka ʻana. |
show |
Hōʻike i ka popover o kekahi mea. Hoʻi i ka mea kelepona ma mua o ka hōʻike ʻia ʻana o ka popover (ʻo ia hoʻi ma mua o ka hiki ʻana o ka shown.bs.popover hanana). Manaʻo ʻia kēia he "manual" triggering o ka popover. ʻAʻole i hōʻike ʻia nā Popovers nona ka inoa a me ka ʻike i ʻole ka lōʻihi. |
toggle |
Hoʻololi i ka popover o kekahi mea. Hoʻi i ka mea kelepona ma mua o ka hōʻike ʻia ʻana a huna ʻana paha o ka popover (ʻo ia hoʻi ma mua o ka hiki ʻana o ka hanana shown.bs.popover a i ʻole). hidden.bs.popover Manaʻo ʻia kēia he "manual" triggering o ka popover. |
toggleEnabled |
Hoʻololi i ka hiki ke hōʻike ʻia a hūnā ʻia paha ka popover o kekahi mea. |
update |
Hoʻohou i ke kūlana o ka popover o kekahi mea. |
// 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
ʻAe ke ʻano i ka
hoʻopaʻapaʻa
object
, kahi i
string
koho pono ʻia kēlā me kēia kī waiwai i loko o ka popover template, a hiki i kēlā me kēia waiwai-waiwai pili ke
string
|
element
|
function
|
null
Nā hanana
Hanana | wehewehe |
---|---|
hide.bs.popover |
Hoʻopau koke ʻia kēia hanana i ka wā hide i kāhea ʻia ai ke ʻano hana. |
hidden.bs.popover |
Hoʻopau ʻia kēia hanana i ka pau ʻana o ka huna ʻana o ka popover mai ka mea hoʻohana (e kali no ka hoʻololi ʻana o CSS). |
inserted.bs.popover |
Hoʻopau ʻia kēia hanana ma hope o ka show.bs.popover hanana i ka wā i hoʻohui ʻia ai ka template popover i ka DOM. |
show.bs.popover |
Hoʻomaka koke kēia hanana i ke show kāhea ʻia ʻana o ke ʻano hana. |
shown.bs.popover |
Hoʻopau ʻia kēia hanana i ka wā i ʻike ʻia ai ka popover i ka mea hoʻohana (e kali no ka hoʻololi ʻana o CSS). |
const myPopoverTrigger = document.getElementById('myPopover')
myPopoverTrigger.addEventListener('hidden.bs.popover', () => {
// do something...
})