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

Dɔwɔnu ƒe Aɖaŋuɖoɖowo

Nuŋlɔɖiwo kple kpɔɖeŋuwo hena Bootstrap dɔwɔnu tɔxɛwo tsɔtsɔ kpe ɖe eŋu kple CSS kple JavaScript to CSS3 zazã me na nɔnɔmetatawo kple data-bs-nɔnɔmewo na teƒea ƒe tanya dzraɖoƒe.

Kpɔɖeŋunyagbɔgblɔ

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

  • Dɔwɔnu ƒe aɖaŋuɖoɖowo ɖoa ŋu ɖe ame etɔ̃lia ƒe agbalẽdzraɖoƒe Popper ŋu ​​hena teƒ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.
  • Dɔwɔnu ƒe aɖaŋuɖoɖowo nye tiatiawɔwɔ le dɔwɔwɔ ta, eyata ele be wò ŋutɔ nàdze wo gɔme .
  • Womeɖea dɔwɔnu ƒe aɖaŋuɖoɖo siwo ƒe tanyawo ƒe didime nye zero la fiana 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).
  • Dɔwɔnu ƒe aɖaŋuɖoɖowo ʋuʋu ɖe nu ɣaɣlawo dzi mawɔ dɔ o.
  • .disabledEle be woaʋu dɔwɔnu ƒe aɖaŋuɖoɖowo na alo elementwo ɖe disabledwrapper element dzi.
  • Ne wodze egɔme tso kadodo siwo le fli geɖe dzi me la, dɔwɔnu ƒe aɖaŋuɖoɖowo anɔ titina. Zã white-space: nowrap;le wò <a>s dzi be nàƒo asa na nuwɔna sia.
  • Ele be woaɣla dɔwɔnu ƒe aɖaŋuɖoɖowo hafi woaɖe woƒe akpa siwo sɔ la ɖa le DOM la me.
  • Woateŋu adze dɔwɔnu ƒe aɖaŋuɖoɖowo gɔme akpe ɖe nusi le vɔvɔli DOM me ŋu.

Nu mawo katã le asiwòa? Gã, na míakpɔ alesi wowɔa dɔe kple kpɔɖeŋu aɖewo ɖa.

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

Kpɔɖeŋuwo

Na dɔwɔnu ƒe aɖaŋuɖoɖowo nawɔ dɔ

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

const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))

Tsɔ asi ɖo kadodo siwo le ete la dzi be nàkpɔ dɔwɔnu ƒe aɖaŋuɖoɖowo:

Teƒeɖoɖo ƒe nuŋɔŋlɔ be woatsɔ aɖe kadodo aɖewo siwo le fli me kple dɔwɔnu ƒe aɖaŋuɖoɖowo afia. Esia nye filler ko fifia, amewula aɖeke meli o. Emenya siwo woda ɖe afisia be woasrɔ̃ nuŋɔŋlɔ ŋutɔŋutɔ ƒe anyinɔnɔ ko . Eye esiawo katã be wòana nàkpɔ alesi dɔwɔnu ƒe aɖaŋuɖoɖowo anɔ ne wozã wo le nɔnɔme ŋutɔŋutɔwo me la ƒe susu aɖe ko. Eyata míele mɔ kpɔm be èkpɔ alesi dɔwɔnu siawo siwo le kadodowo dzi ate ŋu awɔ dɔ le nuwɔna me azɔ, ne ènya zã wo le wò ŋutɔ wò nyatakakadzraɖoƒe alo dɔ aɖe ko.

html
<p class="muted">Placeholder text to demonstrate some <a href="#" data-bs-toggle="tooltip" data-bs-title="Default tooltip">inline links</a> with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of <a href="#" data-bs-toggle="tooltip" data-bs-title="Another tooltip">real text</a>. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how <a href="#" data-bs-toggle="tooltip" data-bs-title="Another one here too">these tooltips on links</a> can work in practice, once you use them on <a href="#" data-bs-toggle="tooltip" data-bs-title="The last tip!">your own</a> site or project.
</p>
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.

Dɔwɔnu siwo wowɔ ɖe ɖoɖo nu

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

Àteŋu atrɔ asi le dɔwɔnu ƒe aɖaŋuɖoɖowo ƒe dzedzeme ŋu to CSS tɔtrɔwo zazã me . Míeɖoa klass tɔxɛ aɖe kple data-bs-custom-class="custom-tooltip"be míakpɔ míaƒe dzedzeme tɔxɛ aɖe eye míezãnɛ tsɔ tsia CSS tɔtrɔ si le nutoa me la nu.

.custom-tooltip {
  --bs-tooltip-bg: var(--bs-primary);
}
html
<button type="button" class="btn btn-secondary"
        data-bs-toggle="tooltip" data-bs-placement="top"
        data-bs-custom-class="custom-tooltip"
        data-bs-title="This top tooltip is themed via CSS variables.">
  Custom tooltip
</button>

Mɔfiamewo

Tsɔ asi ɖo abɔta siwo le ete la dzi be nàkpɔ dɔwɔnu ƒe aɖaŋuɖoɖo eneawo ƒe mɔfiamewo: etame, ɖusime, ete, kple miame. Mɔfiamewo dzena le ahuhɔ̃e me ne wole Bootstrap zãm le RTL me.

<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Tooltip on top">
  Tooltip on top
</button>
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Tooltip on right">
  Tooltip on right
</button>
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Tooltip on bottom">
  Tooltip on bottom
</button>
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="Tooltip on left">
  Tooltip on left
</button>

Eye esi wotsɔ HTML si wowɔ ɖe ɖoɖo nu kpe ɖe eŋu la:

<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-html="true" data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
  Tooltip with HTML
</button>

Le SVG me la:

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, dɔwɔnu ƒe aɖaŋuɖoɖowo zãa teƒea ƒe CSS tɔtrɔwo le fifia .tooltiphena ɣeyiɣi ŋutɔŋutɔ ƒe tɔtrɔwɔwɔ si nyo ɖe edzi. 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}tooltip-zindex: #{$zindex-tooltip};
  --#{$prefix}tooltip-max-width: #{$tooltip-max-width};
  --#{$prefix}tooltip-padding-x: #{$tooltip-padding-x};
  --#{$prefix}tooltip-padding-y: #{$tooltip-padding-y};
  --#{$prefix}tooltip-margin: #{$tooltip-margin};
  @include rfs($tooltip-font-size, --#{$prefix}tooltip-font-size);
  --#{$prefix}tooltip-color: #{$tooltip-color};
  --#{$prefix}tooltip-bg: #{$tooltip-bg};
  --#{$prefix}tooltip-border-radius: #{$tooltip-border-radius};
  --#{$prefix}tooltip-opacity: #{$tooltip-opacity};
  --#{$prefix}tooltip-arrow-width: #{$tooltip-arrow-width};
  --#{$prefix}tooltip-arrow-height: #{$tooltip-arrow-height};
  

Sass ƒe tɔtrɔwo

$tooltip-font-size:                 $font-size-sm;
$tooltip-max-width:                 200px;
$tooltip-color:                     $white;
$tooltip-bg:                        $black;
$tooltip-border-radius:             $border-radius;
$tooltip-opacity:                   .9;
$tooltip-padding-y:                 $spacer * .25;
$tooltip-padding-x:                 $spacer * .5;
$tooltip-margin:                    null; // TODO: remove this in v6

$tooltip-arrow-width:               .8rem;
$tooltip-arrow-height:              .4rem;
// fusv-disable
$tooltip-arrow-color:               null; // Deprecated in Bootstrap 5.2.0 for CSS variables
// fusv-enable

Zãzã

Dɔwɔnu ƒe aɖaŋuɖoɖo ƒe kpeɖeŋutɔa wɔa nyatakakawo kple dzesidede ne wobiae, eye le gɔmedzedzea me la, etsɔa dɔwɔnu ƒe aɖaŋuɖoɖowo ɖoa woƒe nusi ʋãa ame la megbe.

Dze dɔwɔnu ƒe aɖaŋuɖoɖoa gɔme to JavaScript dzi:

const exampleEl = document.getElementById('example')
const tooltip = new bootstrap.Tooltip(exampleEl, options)
Overflow autokplescroll

Dɔwɔnu ƒe dzesi ƒe nɔƒe dzea agbagba be yeatrɔ le eɖokui si ne dzila ƒe nugoe aɖe le overflow: autoalo overflow: scrollabe míaƒe .table-responsive, gake egaléa teƒe gbãtɔ ƒe nɔƒe ɖe te kokoko. Be nàkpɔ esia gbɔ la, ɖo boundarytiatia la (na flip modifier si zãa popperConfigtiatia la) ɖe HTMLElement ɖesiaɖe dzi be wòaɖe asixɔxɔ si woɖo ɖi la ɖa, 'clippingParents', abe document.body:

const tooltip = new bootstrap.Tooltip('#example', {
  boundary: document.body // or document.querySelector('#boundary')
})

Dzesidede dzesiwo

Dzesi si hiã na dɔwɔnu ƒe aɖaŋuɖoɖo nye datanɔnɔme aɖe ko eye titlele HTML ƒe akpaa dzi la, èdi be dɔwɔnu ƒe aɖaŋuɖoɖo nanɔ ye si. Dɔwɔnu ƒe dzesi ƒe dzesi si wowɔ la le bɔbɔe vie, togbɔ be ebia teƒe aɖe hã (le gɔmedzedzea me la, woɖoe ɖe topto plugin la dzi).

Dɔwɔnu ƒe aɖaŋuɖoɖowo wɔwɔ be woawɔ dɔ na keyboard kple kpekpeɖeŋu mɔ̃ɖaŋununya zãlawo

Ele be nàtsɔ dɔwɔnu ƒe aɖaŋuɖoɖowo akpe ɖe HTML ƒe akpa siwo te ŋu nɔa te ɖe keyboard dzi eye wowɔa nu aduadu tso blema ke (abe kadodowo alo nuŋlɔɖiwo dzi kpɔkpɔ ene) ko ŋu. Togbɔ be woateŋu ana HTML ƒe akpa siwo wowɔna le wo ɖokui si (abe <span>s ene) nanye esiwo ŋu woate ŋu aɖo ŋkui 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ŋunamɔnu akpa gãtɔ meɖea gbeƒã dɔwɔnu ƒe aɖaŋuɖoɖoa 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ò dɔwɔnu ƒe aɖaŋuɖoɖo o, elabena esia ana wò dɔwɔnu ƒe aɖaŋuɖoɖowo mate ŋu aʋã keyboard zãlawo o.

<!-- HTML to write -->
<a href="#" data-bs-toggle="tooltip" data-bs-title="Some tooltip text!">Hover over me</a>

<!-- Generated markup by the plugin -->
<div class="tooltip bs-tooltip-top" role="tooltip">
  <div class="tooltip-arrow"></div>
  <div class="tooltip-inner">
    Some tooltip text!
  </div>
</div>

Nuwɔametɔwo ƒe akpawo

Elements siwo si disablednɔnɔmea le la mewɔa dɔ ɖekae o, si fia be ezãlawo mateŋu atsɔ susu aɖo wo ŋu, atsɔ asi aɖo wo dzi, alo azi wo dzi atsɔ adze dɔwɔnu ƒe aɖaŋuɖoɖo (alo popover) gɔme o. Abe egbɔkpɔnu ene la, àdi be yeaʋu dɔwɔnu ƒe aɖaŋuɖoɖoa tso agbalẽ xatsaxatsa <div>alo <span>, si sɔ nyuie be woawɔ keyboard-focusable to tabindex="0".

html
<span class="d-inline-block" tabindex="0" data-bs-toggle="tooltip" data-bs-title="Disabled tooltip">
  <button class="btn btn-primary" type="button" disabled>Disabled button</button>
</span>

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 dɔwɔnu ƒe aɖaŋuɖoɖoa dzi.
boundary ka, nu vevi aɖe 'clippingParents' Dɔwɔnu ƒe aɖaŋuɖoɖo ƒe mɔxexeɖedɔléle nu ƒe liƒo (eku ɖe Popper ƒe preventOverflow tɔtrɔɖenu 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 Tsɔ dɔwɔnu ƒe aɖaŋuɖoɖoa kpe ɖ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 dɔwɔnu ƒe nugbɔ ɖe nuŋlɔɖi ƒe sisi me le nusi te ɖe nusi ʋãa nu ŋu - si axe mɔ na dɔwɔnu ƒe nugbɔ be wòagadzo le nusi ʋãa dɔa gbɔ le fesre ƒe lolome tɔtrɔ me o.
customClass ka, dɔwɔwɔ '' Tsɔ klasswo kpe ɖe dɔwɔnu ƒe aɖaŋuɖoɖoa ŋ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 Hehe ɖe megbe le dɔwɔnu ƒe aɖaŋuɖoɖo (ms) ɖeɖefia kple eɣla ɖe megbe—meku ɖe manual trigger type ŋ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 ƒuƒoƒo ƒe ƒ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 dɔwɔnu ƒe aɖaŋuɖoɖoa me. Ne enye nyateƒe la, woaɖe HTML dzesi siwo le dɔwɔnu ƒe aɖaŋuɖoɖoa me titlela gɔme le dɔwɔnu ƒe aɖaŋuɖoɖoa 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 array, ka, dɔwɔwɔ [0, 0] Dɔwɔnu ƒe aɖaŋuɖoɖo ƒe vovototodedeameme 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' Alesi nàɖo dɔwɔnu ƒe aɖaŋuɖoɖoa ɖe teƒe: auto, dzi, ete, miame, ɖusime. Ne autowogblɔe la, atrɔ asi le dɔwɔnu ƒe aɖaŋuɖoɖoa ŋ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 dɔwɔnu ƒe dzesi DOM node abe eƒe nyaʋiʋli gbãtɔ ene eye nusi ʋãa nu DOM node abe eƒe evelia ene. Woɖo thisnya siwo ƒo xlãe la ɖe dɔwɔnu ƒe aɖaŋuɖoɖo ƒ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ɔ dɔwɔnu ƒe aɖaŋuɖoɖo nuawo ade asi na taɖodzinu siwo woɖo. Le nuwɔna me la, wozãa esia tsɔ wɔa dɔwɔnu ƒe aɖaŋuɖoɖowo hã ŋudɔ ɖe DOM ƒe akpa siwo wotsɔ kpe ɖe eŋu le mɔ si trɔna nu ( jQuery.onkpekpeɖeŋu). Kpɔ tata sia kple kpɔɖeŋu si me nyatakaka geɖe le .
template ka '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' Gɔmeɖoanyi HTML si nàzã ne èle dɔwɔnu ƒe aɖaŋuɖoɖoa wɔm. Woado dɔwɔnu ƒe aɖaŋuɖoɖoa titleɖe .tooltip-inner. .tooltip-arrowava zu dɔwɔnua ƒe aŋutrɔ. Ele be .tooltipklass kple role="tooltip".
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 dɔwɔnu ƒe aɖaŋuɖoɖo 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 dɔwɔnu ƒe aɖaŋuɖoɖoa gɔme le ɖoɖo nu to .tooltip('show'), .tooltip('hide')kple .tooltip('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 ana dɔwɔnu ƒe aɖaŋuɖoɖo siwo womate ŋu adze egɔme to keyboard la dzi o, eye ne mɔnu bubu siwo dzi woato agblɔ nyatakaka mawo ke na keyboard zãlawo li ko hafi woazã wo.

Nyatakaka ƒe nɔnɔmewo na dɔwɔnu ɖekaɖekawo ƒe aɖaŋuɖoɖowo

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

Zã dɔwɔwɔ kplepopperConfig

const tooltip = new bootstrap.Tooltip(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 ŋutete si le element ƒe dɔwɔnu ƒe aɖaŋuɖoɖo ŋu be woaɖee afia la ɖa. Ne wogbugbɔe wɔ dɔ ko hafi woate ŋu aɖe dɔwɔnu ƒe aɖaŋuɖoɖoa afia.
dispose Ɣla element ƒe dɔwɔnu ƒe aɖaŋuɖoɖo eye wòtsrɔ̃nɛ (Eɖea nyatakaka siwo wodzra ɖo ɖe DOM element la dzi ɖa). Dɔwɔnu ƒe aɖaŋuɖoɖo 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 be woaɖee afia element aɖe ƒe dɔwɔnu ƒe aɖaŋuɖoɖo. Wowɔa dɔwɔnu ƒe aɖaŋuɖoɖowo ŋudɔ le gɔmedzedzea me.
getInstance Static mɔnu si ɖea mɔ na wò be nàxɔ dɔwɔnu ƒe aɖaŋuɖoɖo ƒe kpɔɖeŋu si do ƒome kple DOM ƒe akpa aɖe, alo awɔ yeye nenye be womedze egɔme o.
getOrCreateInstance Static mɔnu si ɖea mɔ na wò be nàxɔ dɔwɔnu ƒe aɖaŋuɖoɖo ƒe kpɔɖeŋu si do ƒome kple DOM ƒe akpa aɖe, alo awɔ yeye nenye be womedze egɔme o.
hide Ɣla element aɖe ƒe dɔwɔnu ƒe aɖaŋuɖoɖo. Trɔ yi yɔla gbɔ hafi woɣla dɔwɔnu ƒe aɖaŋuɖoɖoa ŋutɔŋutɔ (si nye hafi hidden.bs.tooltipnudzɔdzɔa nadzɔ). Wobua esia be enye dɔwɔnu ƒe aɖaŋuɖoɖoa ƒe “asi” ƒe dɔwɔwɔ.
setContent Enaa mɔnu aɖe si dzi woato atrɔ dɔwɔnu ƒe aɖaŋuɖoɖoa me nyawo le eƒe gɔmedzedze megbe.
show Eɖea element aɖe ƒe dɔwɔnu ƒe aɖaŋuɖoɖo fiana. Trɔ yi yɔla gbɔ hafi woɖe dɔwɔnu ƒe aɖaŋuɖoɖoa fia ŋutɔŋutɔ (si nye hafi shown.bs.tooltipnudzɔdzɔa nadzɔ). Wobua esia be enye dɔwɔnu ƒe aɖaŋuɖoɖoa ƒe “asi” ƒe dɔwɔwɔ. Womeɖea dɔwɔnu ƒe aɖaŋuɖoɖo siwo ƒe tanyawo ƒe didime nye zero la fiana gbeɖe o.
toggle Trɔa element aɖe ƒe dɔwɔnu ƒe aɖaŋuɖoɖo. Trɔ yi yɔla gbɔ hafi woɖe dɔwɔnu ƒe aɖaŋuɖoɖoa fia ŋutɔŋutɔ alo ɣlae (si nye hafi shown.bs.tooltipalo hidden.bs.tooltipnudzɔdzɔa nadzɔ). Wobua esia be enye dɔwɔnu ƒe aɖaŋuɖoɖoa ƒe “asi” ƒe dɔwɔwɔ.
toggleEnabled Trɔ ŋutete si le element ƒe dɔwɔnu ƒe aɖaŋuɖoɖo ŋu be woaɖee afia alo aɣla.
update Trɔ asi le element aɖe ƒe dɔwɔnu ƒe aɖaŋuɖoɖo ƒe nɔƒe ŋu.
const tooltip = bootstrap.Tooltip.getInstance('#example') // Returns a Bootstrap tooltip instance

// setContent example
tooltip.setContent({ '.tooltip-inner': 'another title' })
Mɔnua setContentxɔa objectnyaʋiʋli aɖe, afisi nunɔamesi-safui ɖesiaɖe nye nusi sɔ string le 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.tooltip Woɖea nudzɔdzɔ sia ɖa enumake ne woyɔ hideinstance mɔnu la.
hidden.bs.tooltip 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.tooltip Woɖea nudzɔdzɔ sia ɖa le nudzɔdzɔa megbe show.bs.tooltipne wotsɔ dɔwɔnu ƒe aɖaŋuɖoɖo ƒe nɔnɔmetata kpe ɖe DOM ŋu.
show.bs.tooltip Nudzɔdzɔ sia doa dzo enumake ne woyɔ showkpɔɖeŋu mɔnu la.
shown.bs.tooltip 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 myTooltipEl = document.getElementById('myTooltip')
const tooltip = bootstrap.Tooltip.getOrCreateInstance(myTooltipEl)

myTooltipEl.addEventListener('hidden.bs.tooltip', () => {
  // do something...
})

tooltip.hide()