Trɔ yi nya veviwo gbɔ Trɔ yi docs ƒe mɔfiamewo dzi
Check
in English

Popovers ƒe amewo

Nuŋlɔɖiwo kple kpɔɖeŋuwo hena Bootstrap popovers, abe esiwo wokpɔ le iOS me ene, tsɔtsɔ kpe ɖe nu ɖesiaɖe si le wò nyatakakadzraɖoƒea ŋu.

Kpɔɖeŋunyagbɔgblɔ

Nusiwo wòle be nànya ne èle popover ƒe kpeɖeŋutɔa zãm:

  • Popovers ɖoa ŋu ɖe ame etɔ̃lia ƒe agbalẽdzraɖoƒe Popper ŋu ​​hena ɖoƒeɖoɖo. Ele be nàde popper.min.js do ŋgɔ na bootstrap.js, alo nàzã ɖeka bootstrap.bundle.min.jssi me Popper le.
  • Popovers hiã popover plugin abe nusi dzi woanɔ te ɖo ene.
  • Popovers nye opt-in le dɔwɔwɔ ƒe susuwo ta, eyata ele be wò ŋutɔ nàdze wo gɔme .
  • Zero-didime titlekple contentasixɔxɔwo maɖe popover afia gbeɖe o.
  • Tsɔe container: 'body'be nàƒo asa na gbegɔmeɖeɖe ƒe kuxiwo le akpa siwo sesẽ wu me (abe míaƒe nyawo tsɔtsɔ de eme ƒe ƒuƒoƒowo, abɔta ƒe ƒuƒoƒowo, kple bubuawo ene).
  • Popovers ʋuʋu ɖe nu ɣaɣlawo dzi mawɔ dɔ o.
  • Ele be woadze popovers na .disabledalo disabledelements gɔme ɖe wrapper element dzi.
  • Ne wodze seke siwo xatsa ɖe fli geɖe dzi la, popovers la anɔ titina le sekeawo ƒe kekeme bliboa dome. Zã .text-nowraple wò <a>s dzi be nàƒo asa na nuwɔna sia.
  • Ele be woaɣla popovers hafi woaɖe woƒe akpa siwo sɔ kplii ɖa le DOM la me.
  • Popovers ateŋu adze egɔme akpe ɖe element aɖe si le vɔvɔli DOM me ŋu.
Le gɔmedzedzea me la, akpa sia zãa emenyawo ŋuti kɔklɔ si wotu ɖe eme, si ɖea HTML ƒe akpa ɖesiaɖe si ŋu womeɖe mɔ ɖo tẽ o la ɖa. Kpɔ akpa si nye sanitizer le míaƒe JavaScript nuŋlɔɖiwo me hena numeɖeɖe bubuwo.
Akpa sia ƒe nɔnɔmetata ƒe ŋusẽkpɔɖeamedzi nɔ te ɖe prefers-reduced-motionnyadzɔdzɔgblɔmɔnuwo ƒe nyabiasea dzi. Kpɔ míaƒe mɔnukpɔkpɔwo ŋuti nuŋlɔɖiwo ƒe akpa si woɖe dzi kpɔtɔ .

Yi edzi nànɔ nu xlẽm be nàkpɔ alesi popovers wɔa dɔe kple kpɔɖeŋu aɖewo.

Kpɔɖeŋuwo

Na popovers nawɔ dɔ

Abe alesi míegblɔe le etame ene la, ele be nàdze popovers gɔme hafi woate ŋu azã wo. Mɔ ɖeka si dzi woato adze popovers katã gɔme le axa aɖe dzi enye be woatia wo to woƒe data-bs-togglenɔnɔme nu, abe ale:

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

Live demo ƒe wɔwɔfia

Míezãa JavaScript si sɔ kple snippet si le etame tsɔ ɖea live popover si gbɔna la gɔme. Woɖoa tanyawo to data-bs-titleeye woɖoa ŋutilã me nyawo to data-bs-content.

Zã wo dometɔ ɖesiaɖe titlealo data-bs-titlele wò HTML me faa. Ne titlewozãe la, Popper aɖɔlii le eɖokui si kple data-bs-titlene woɖe element la gɔme.
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>

Mɔfiame ene

Tiatia ene li: etame, ɖusime, ete, kple miame. Mɔfiamewo dzena le ahuhɔ̃e me ne wole Bootstrap zãm le RTL me. Ðoe data-bs-placementbe nàtrɔ mɔfiame la.

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>

Dekᴐnucontainer

Ne atsyã aɖewo le dzila ƒe akpa aɖe dzi siwo doa kplamatse popover la, àdi be yeagblɔ ɖoɖo aɖe containerale be popover la ƒe HTML nadze le akpa ma me boŋ. Esia bɔ ɖe kplɔ̃ siwo ɖoa nya ŋu, nyawo tsɔtsɔ de eme ƒe ƒuƒoƒowo, kple esiawo tɔgbe me.

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

Nɔnɔme bubu si me nàdi be yeaɖo dekɔnu si me kɔ containerlae nye popovers le modal dialog me , be nàkpɔ egbɔ be wotsɔ popover la ŋutɔ kpe ɖe modal la ŋu. Esia le vevie ŋutɔ na popovers siwo me nuwɔna ƒe akpawo le – modal dzeɖoɖowo atre susu, eyata negbe ɖe popover nye vi ƒe akpa aɖe le modal la, ezãlawo mate ŋu atsɔ susu aɖo nu ŋu alo awɔ nu siawo ŋudɔ o.

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

Dekɔnu popovers

Wotsɔe kpe ɖe eŋu le v5.2.0 me

Àteŋu atrɔ asi le popovers ƒe dzedzeme ŋu to CSS tɔtrɔwo zazã me . Míeɖoa klass tɔxɛ aɖe kple data-bs-custom-class="custom-popover"be míakpɔ míaƒe dzedzeme tɔxɛa eye míezãnɛ tsɔ ɖea CSS ƒe tɔtrɔ aɖewo siwo le nutoa me la ɖa.

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

Ðe asi le eŋu le ʋuʋu si kplɔe ɖo me

focustrigger la tsɔ gbe popovers le zãla ƒe ʋuʋu si kplɔe ɖo le element si to vovo na toggle element la dzi.

Dzesi tɔxɛ aɖe hiã na dismiss-ne-next-click

Be nàkpɔ cross-browser kple cross-platform ƒe nuwɔna nyuie la, ele be nàzã <a>tag la, ke menye tag la o <button>, eye ele be nàde tabindexnɔnɔme aɖe hã eme.

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

Nuwɔametɔwo ƒe akpawo

Elements kple disabledattribute la menye interactive o, si fia be zãlawo mateŋu atsɔ asi aɖo wo dzi alo azi wo dzi atsɔ aʋã popover (alo tooltip) o. Abe egbɔkpɔnu ene la, àdi be yeaʋu popover la tso wrapper <div>alo <span>, si wowɔ nyuie be woate ŋu atsɔ keyboard-focusable zã tabindex="0".

Le popover triggers siwo nye nuwɔametɔwo gome la, àte ŋu alɔ̃ hã data-bs-trigger="hover focus"be popover la nadze abe nukpɔkpɔ ƒe nyaŋuɖoɖo enumake ene na wò zãlawo elabena ɖewohĩ womakpɔ mɔ be yewoazi nuwɔametɔ ƒe akpa aɖe dzi o.

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 ƒe ƒuƒoƒo

Nusiwo trɔna

Wotsɔe kpe ɖe eŋu le v5.2.0 me

Abe Bootstrap ƒe CSS tɔtrɔwo ƒe mɔnu si le tɔtrɔm ƒe akpa aɖe ene la, popovers zãa teƒea ƒe CSS tɔtrɔwo le fifia .popoverhena ɣeyiɣi ŋutɔŋutɔ ƒe tɔtrɔwo ƒe ŋgɔyiyi si wodo ɖe ŋgɔ. Woɖo asixɔxɔwo na CSS ƒe tɔtrɔwo to Sass dzi, eyata Sass ƒe tɔtrɔwɔwɔ gakpɔtɔ doa alɔ, hã.

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

Sass ƒe tɔtrɔwo

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

Zãzã

Na popovers nawɔ dɔ to JavaScript dzi:

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

Popovers wɔwɔ nawɔ dɔ na keyboard kple kpekpeɖeŋu mɔ̃ɖaŋununya zãlawo

Be nàɖe mɔ na keyboard zãlawo be woawɔ wò popovers la, ɖeko wòle be nàtsɔ wo akpe ɖe HTML ƒe akpa siwo te ŋu nɔa te ɖe keyboard dzi eye wowɔa nu aduadu le blema (abe kadodowo alo agbalẽvi dzi kpɔkpɔwo ene) la ŋu. Togbɔ be woateŋu ana HTML ƒe akpa siwo wowɔna le wo ɖokui si (abe <span>s ene) nate ŋu alé ŋku ɖe wo ŋu to nɔnɔmea tsɔtsɔ kpee me hã la tabindex="0", esia atsɔ tab ƒe tɔtrɔ siwo ate ŋu ado dziku eye woatɔtɔ ame akpe ɖe nusiwo mewɔa dɔ kple wo nɔewo o ŋu na keyboard zãlawo, eye kpekpeɖeŋu mɔ̃ɖaŋununya akpa gãtɔ meɖea gbeƒã popover la ƒe nyawo le nɔnɔme sia me fifia o . Tsɔ kpe ɖe eŋu la, mègaɖo ŋu ɖe eŋu ɖeɖeko hoverbe wòanye nusi aʋã wò popovers o, elabena esia ana be womate ŋu aʋã wo na keyboard zãlawo o.

Togbɔ be àte ŋu ade HTML si me kesinɔnuwo le, si woɖo ɖe ɖoɖo nu la popovers me kple htmltiatia la, míele aɖaŋu ɖom na wò vevie be nàƒo asa na nyatakaka gbogbo aɖewo tsɔtsɔ kpee. Alesi popovers wɔa dɔe fifia enye be, ne wonya ɖe wo fia ko la, woblaa woƒe emenyawo ɖe trigger element la ŋu kple aria-describedbyattribute la. Esia awɔe be woaɖe gbeƒã popover la me nyawo katã na mɔ̃ɖaŋununya siwo kpena ɖe ame ŋu zãlawo abe tɔsisi didi ɖeka si me womeɖea asi le o ene.

Tsɔ kpe ɖe eŋu la, togbɔ be anya wɔ hã be nàde nuwɔwɔ ƒe dziɖuɖuwo (abe nɔnɔme ƒe akpawo alo kadodowo ene) wò popover me (to nu siawo tsɔtsɔ kpe ɖe allowListnɔnɔme kple dzesi siwo ŋu woɖe mɔ ɖo ŋu) hã la, nyae be fifia la, popover la mekpɔa keyboard ƒe susu ƒe ɖoɖo dzi o. Ne keyboard zãla ʋu popover la, susu nɔa nusi ʋãa ame ŋu, eye esi wònye be zi geɖe la, popover la mekplɔa nusi ʋãa ame ɖo enumake le nuŋlɔɖia ƒe wɔwɔme me o ta la, kakaɖedzi aɖeke meli be yi ŋgɔ/azi edzi oTABaʋu keyboard zãla aɖe ɖe popover la ŋutɔ me. Kpuie ko la, ne wotsɔ nuwɔwɔ aduadu ƒe dziɖuɖuwo kpe ɖe popover ŋu ​​ko la, anɔ eme be ana dziɖuɖu siawo nazu nusiwo gbɔ womate ŋu aɖo o/womate ŋu azã wo na keyboard zãlawo kple kpekpeɖeŋu mɔ̃ɖaŋunuwo zãlawo o, alo ne mede ɖeke o la, ana woawɔ ɖoɖo si me susu mele o le nusianu me. Le nɔnɔme siawo me la, bu modal dialog zazã boŋ ŋu.

Tiatiawɔblɔɖewo

Esi woateŋu atsɔ tiatiawɔnuwo ato nyatakaka nɔnɔmewo alo JavaScript dzi ta la, àteŋu atsɔ tiatia ŋkɔ akpe ɖe data-bs-, abe alesi wòle le data-bs-animation="{value}". Kpɔ egbɔ be yetrɔ tiatia ŋkɔa ƒe case type tso “ camelCase ” yi “ kebab-case ” ne èle tiatiaawo tom to data attributes dzi. Le kpɔɖeŋu me, zãe data-bs-custom-class="beautifier"ɖe data-bs-customClass="beautifier".

Tso Bootstrap 5.2.0 dzi la, akpaawo katã doa alɔ dodokpɔ ƒe nyatakaka si wodzra ɖo ƒe nɔnɔme data-bs-configsi ateŋu axɔ akpa ƒe ɖoɖo bɔbɔe abe JSON ka ene. Ne element aɖe si data-bs-config='{"delay":0, "title":123}'kple data-bs-title="456"nɔnɔmewo le la, asixɔxɔ mamlɛtɔ titleanye 456eye nyatakaka nɔnɔme vovovoawo axɔ asixɔxɔ siwo wona le data-bs-config. Tsɔ kpe ɖe eŋu la, nyatakaka ƒe nɔnɔme siwo li fifia te ŋu tsɔa JSON ƒe asixɔxɔwo abe data-bs-delay='{"show":0,"hide":150}'.

De dzesii be le dedienɔnɔ ta la , womate ŋu atsɔ nyatakaka ƒe nɔnɔmewo ana sanitize, sanitizeFn, kple tiatiaawo o.allowList
Ŋkɔ Ƒomevi Gᴐmedzeƒe Nuɖᴐɖᴐ
allowList nu Asixɔxɔ si woɖo ɖi Nusi me nɔnɔme kple dzesi siwo ŋu woɖe mɔ ɖo le.
animation boolean ƒe ƒuƒoƒo true Wɔ CSS fade ƒe tɔtrɔ ɖe popover la ŋu.
boundary ka, nu vevi aɖe 'clippingParents' Overflow mɔxexeɖenu liƒo na popover (eku ɖe Popper ƒe preventOverflow modifier ko ŋu). Le gɔmedzedzea me la, enye 'clippingParents'eye ateŋu axɔ HTMLElement ƒe nufiame (to JavaScript ɖeɖeko dzi). Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe detectOverflow docs .
container ka, element, alakpa false Etsɔa popover la kpena ɖe nu aɖe koŋ ŋu. Kpɔɖeŋu: container: 'body'. Tiatia sia ɖea vi ŋutɔ le esi wòɖea mɔ na wò be nàɖo popover la ɖe nuŋlɔɖia ƒe sisi me le nusi te ɖe nusi ʋãa nu ŋu - si axe mɔ na popover la be wòagadzo le nusi ʋãa ame gbɔ le fesre ƒe lolome tɔtrɔ me o.
content ka, element, dɔwɔwɔ '' Default content value ne data-bs-contentnɔnɔme mele afima o. Ne wotsɔ dɔwɔwɔ aɖe na la, woayɔe kple eƒe thisnufiame ɖoɖo ɖe element si wotsɔ popover la kpe ɖe eŋu la ŋu.
customClass ka, dɔwɔwɔ '' Tsɔ klasswo kpe ɖe popover la ŋu ne woɖee fia. De dzesii be woatsɔ klass siawo akpe ɖe klass ɖesiaɖe si wogblɔ le template la me ŋu. Be nàtsɔ klass geɖe akpe ɖe eŋu la, ma wo dome kple dometsotsowo: 'class-1 class-2'. Àteŋu atsɔ dɔwɔwɔ aɖe hã si wòle be wòatrɔ ka ɖeka si me klass ŋkɔ bubuwo le la ŋu.
delay xexlẽdzesi, nu 0 Popover (ms) la ɖeɖefia kple eɣla ɖe megbe—meku ɖe manual trigger ƒomevi ŋu o. Ne wotsɔ xexlẽdzesi aɖe na la, wozãa megbedede ɖe ɣla/ɖee fia siaa ŋu. Nuwo ƒe wɔwɔmee nye: delay: { "show": 500, "hide": 100 }.
fallbackPlacements ka, ƒuƒoƒo ['top', 'right', 'bottom', 'left'] Ðe fallback teƒewo gɔme to teƒewo ƒe xexlẽdzesi nana le ƒuƒoƒo me (le ɖoɖo si nu nèdi nu). Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe nuwɔna ŋuti nuŋlɔɖiwo .
html boolean ƒe ƒuƒoƒo false Ðe mɔ na HTML le popover la me. Ne enye nyateƒe la, woaɖe HTML tag siwo le popover titlela me gɔme le popover la me. Ne alakpae la, innerTextwoazã nunɔamesi atsɔ ade emenyawo DOM la me. Zã nuŋɔŋlɔ ne ètsi dzi ɖe XSS ƒe amedzidzedzewo ŋu.
offset xexlẽdzesi, ka, dɔwɔwɔ [0, 0] Offset of the popover ne wotsɔe sɔ kple eƒe taɖodzinu. Àteŋu atsɔ ka aɖe ayi nyatakaka nɔnɔmewo me kple asixɔxɔ siwo woɖe ɖe vovo le domedome abe: data-bs-offset="10,20". Ne wozã dɔwɔwɔ aɖe tsɔ nya offset la, woyɔnɛ kple nusi me popper ƒe ɖoɖo, nufiame, kple popper rects le abe eƒe nyaʋiʋli gbãtɔ ene. Wotsɔa nusi ʋãa nu DOM node la toa eme abe nyaʋiʋli evelia ene. Ele be dɔwɔwɔa natrɔ ƒuƒoƒo si me xexlẽdzesi eve le: skidding , distance . Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe offset docs .
placement ka, dɔwɔwɔ 'top' Ale si nàɖo popover la ɖe teƒe: auto, dzi, ete, miame, ɖusime. Ne autowogblɔe la, atrɔ asi le popover la ŋu le mɔ si trɔna nu. Ne wozã dɔwɔwɔ aɖe tsɔ nya teƒe si woɖoe ɖo la, woyɔnɛ kple popover DOM node abe eƒe nyaʋiʋli gbãtɔ ene eye triggering element DOM node abe eƒe evelia ene. Woɖo thisnya siwo ƒo xlãe ɖe popover ƒe kpɔɖeŋua dzi.
popperConfig null, nu, dɔwɔwɔ null Ne èdi be yeatrɔ Bootstrap ƒe Popper ƒe ɖoɖowɔɖi gbãtɔ la, kpɔ Popper ƒe ɖoɖowɔɖi . Ne wozã dɔwɔwɔ aɖe tsɔ wɔ Popper ƒe ɖoɖowɔɖi la, woyɔnɛ kple nusi me Bootstrap ƒe Popper ƒe ɖoɖowɔɖi gbãtɔ le. Ekpena ɖe ŋuwò nèzãa default la eye nàtsɔe aƒo ƒu kple wò ŋutɔ wò ɖoɖowɔɖi. Ele be dɔwɔwɔa natrɔ ɖoɖowɔɖi ƒe nu aɖe na Popper.
sanitize boolean ƒe ƒuƒoƒo true Na dzadzɛnyenyea nawɔ dɔ alo nàgawɔ dɔ o. If activated 'template', 'content'kple 'title'tiatiawɔblɔɖewo anye sanitized.
sanitizeFn null, dɔwɔwɔ null Afisiae nàte ŋu ana wò ŋutɔ wò sanitize dɔwɔwɔ. Esia ate ŋu aɖe vi ne èdi be yeazã agbalẽdzraɖoƒe si woɖo ɖi atsɔ awɔ dzadzɛnyenyedɔ.
selector ka, alakpa false Ne wotsɔ tiatiawɔnu aɖe na la, woatsɔ popover nuawo ade asi na taɖodzinu siwo woɖo. Le nuwɔna me la, wozãa esia tsɔ zãa popovers hã ɖe dynamically added DOM elements ( jQuery.onsupport) ŋu. Kpɔ tata sia kple kpɔɖeŋu si me nyatakaka geɖe le .
template ka '<div class="popover" role="popover"><div class="popover-arrow"></div><div class="popover-inner"></div></div>' Gɔmeɖoanyi HTML be nàzã ne èle popover la wɔm. Woado popover titlela ɖe .popover-inner. .popover-arrowava zu popover la ƒe aŋutrɔ. Ele be .popoverklass kple role="popover".
title ka, element, dɔwɔwɔ '' Tanya ƒe asixɔxɔ gbãtɔ ne titlenɔnɔme mele afima o. Ne wotsɔ dɔwɔwɔ aɖe na la, woayɔe kple eƒe thisnufiame ɖoɖo ɖe element si wotsɔ popover la kpe ɖe eŋu la ŋu.
trigger ka 'hover focus' Alesi wodzea popover gɔmee: zi edzi, tsɔ asi ɖo eŋu, lé ŋku ɖe nu ŋu, asi. Àte ŋu ato nu geɖe siwo aʋã wò la me; tsɔ dometsotso aɖe ma wo dome. 'manual'ɖee fia be woadze popover la gɔme le ɖoɖo nu to .popover('show'), .popover('hide')kple .popover('toggle')mɔnuwo dzi; womate ŋu atsɔ asixɔxɔ sia aƒo ƒu kple nusi aʋã ame bubu aɖeke o. 'hover'le eɖokui si la, ana popovers siwo womate ŋu adze egɔme to keyboard dzi o vɛ, eye ne mɔnu bubu siwo dzi woato agblɔ nyatakaka ɖeka ma ke na keyboard zãlawo li ko hafi wòle be woazãe.

Data nɔnɔmewo na ame ɖekaɖekawo ƒe popovers

Woateŋu agblɔ tiatia siwo woawɔ na popover ɖekaɖekawo le mɔ bubu nu to nyatakaka ƒe nɔnɔmewo zazã me, abe alesi woɖe eme le etame ene.

Zã dɔwɔwɔ kplepopperConfig

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

Mɔnuwo

Mɔnu siwo mewɔ ɖeka kple ɣeyiɣi aɖeke o kple tɔtrɔwo

API mɔnuwo katã nye asynchronous eye wodzea tɔtrɔ gɔme . Wotrɔna yia ame si le ka ƒom na la gbɔ ne wonya dze tɔtrɔa gɔme ko gake hafi wòwu enu . Tsɔ kpe ɖe eŋu la, woaŋe aɖaba aƒu mɔnu ƒe yɔyɔ aɖe dzi le akpa si le tɔtrɔm dzi .

Kpɔ míaƒe JavaScript nuŋlɔɖiwo hena nyatakaka bubuwo .

Nuwɔmɔnu Nuɖᴐɖᴐ
disable Eɖea ŋutete si le element aɖe ƒe popover fiana la ɖa. Ne wogbugbɔe wɔ dɔ ko hafi woate ŋu aɖe popover la afia.
dispose Ɣla eye wòtsrɔ̃a element ƒe popover (Eɖea nyatakaka siwo wodzra ɖo ɖe DOM element la dzi ɖa). Popovers siwo zãa delegation (si wowɔ to tiatia ) zazã me laselector mateŋu atsrɔ̃ ɖekaɖeka le dzidzime ƒe trigger elements dzi o.
enable Enaa ŋutete si le element aɖe ƒe popover ŋu ​​be woaɖee afia. Wowɔa Popovers ŋudɔ le gɔmedzedzea me.
getInstance Static mɔnu si ɖea mɔ na wò be nàxɔ popover ƒe kpɔɖeŋu si do ƒome kple DOM ƒe akpa aɖe.
getOrCreateInstance Static mɔnu si ɖea mɔ na wò be nàxɔ popover ƒe kpɔɖeŋu si do ƒome kple DOM ƒe akpa aɖe, alo awɔ yeye nenye be womedze egɔme o.
hide Eɣlaa element aɖe ƒe popover. Trɔ yi amesi yɔe gbɔ hafi woɣla popover la ŋutɔŋutɔ (si nye hafi hidden.bs.popovernudzɔdzɔa nadzɔ). Wobua esia be enye “asi” si wotsɔ ʋãa amedzidzedzea.
setContent Enaa mɔnu aɖe si dzi woato atrɔ popover la ƒe nyawo le eƒe gɔmedzedze megbe.
show Eɖea element aɖe ƒe popover fiana. Trɔ yi amesi yɔe gbɔ hafi woɖe popover la fia ŋutɔŋutɔ (si nye hafi shown.bs.popovernudzɔdzɔa nadzɔ). Wobua esia be enye “asi” si wotsɔ ʋãa amedzidzedzea. Womeɖea Popovers siwo ƒe tanya kple emenyawo siaa nye zero-didime fiana gbeɖe o.
toggle Trɔa element aɖe ƒe popover. Trɔ yi amesi yɔe gbɔ hafi woɖe popover la fia ŋutɔŋutɔ alo ɣlae (si nye hafi shown.bs.popoveralo hidden.bs.popovernudzɔdzɔa nadzɔ). Wobua esia be enye “asi” si wotsɔ ʋãa amedzidzedzea.
toggleEnabled Toggles ŋutete na element ƒe popover be woaɖe afia alo aɣla.
update Trɔ asi le element aɖe ƒe popover ƒe nɔƒe ŋu.
// 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'
})
Mɔnua setContentxɔa objectnyaʋiʋli aɖe, afisi nunɔamesi-safui ɖesiaɖe nye tiatiawɔla si sɔ stringle popover ƒe nɔnɔmetata me, eye nunɔamesi-asixɔxɔ ɖesiaɖe si do ƒome kplii ateŋu anye string| element| function| null

Nudzɔdzɔwo

Nudzᴐdzᴐ Nuɖᴐɖᴐ
hide.bs.popover Woɖea nudzɔdzɔ sia ɖa enumake ne woyɔ hideinstance mɔnu la.
hidden.bs.popover Woɖea nudzɔdzɔ sia ɖa ne popover la ɣla ɖe zãla la vɔ (alala be CSS ƒe tɔtrɔwo nawu enu).
inserted.bs.popover Woɖea nudzɔdzɔ sia ɖa le nudzɔdzɔa megbe show.bs.popoverne wotsɔ popover ƒe nɔnɔmetata kpe ɖe DOM ŋu.
show.bs.popover Nudzɔdzɔ sia doa dzo enumake ne woyɔ showkpɔɖeŋu mɔnu la.
shown.bs.popover Woɖea nudzɔdzɔ sia ɖa ne wowɔ popover la be wòadze na zãla (alala CSS ƒe tɔtrɔwo be woawu enu).
const myPopoverTrigger = document.getElementById('myPopover')
myPopoverTrigger.addEventListener('hidden.bs.popover', () => {
  // do something...
})