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 3rd party agbalẽdzraɖoƒe Popper ŋu ​​hena ɖoƒeɖoɖo. Ele be nàde popper.min.js hafi bootstrap.js alo nàzã bootstrap.bundle.min.js/ bootstrap.bundle.jssi me Popper le hafi popovers nawɔ dɔ!
  • Popovers hiã tooltip plugin abe nusi dzi woanɔ te ɖo ene.
  • Ne èle míaƒe JavaScript tum tso dzɔtsoƒe la, ebia beutil.js .
  • 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ŋu: Na popovers nawɔ dɔ le afisiafi

Mɔ ɖeka si dzi woato adze popovers katã gɔme le axa aɖe dzi enye be woatia wo to woƒe data-togglenɔnɔme nu:

$(function () {
  $('[data-toggle="popover"]').popover()
})

Kpɔɖeŋu: containerTiatiawɔblɔɖea zazã

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

$(function () {
  $('.example-popover').popover({
    container: 'body'
  })
})

Kpɔɖeŋu

<button type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-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.

<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Top popover">
  Popover on top
</button>
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="right" data-content="Right popover">
  Popover on right
</button>
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Bottom popover">
  Popover on bottom
</button>
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="left" data-content="Left popover">
  Popover on left
</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.

<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
$('.popover-dismiss').popover({
  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 dɔwɔwɔ ene la, àdi be yeaʋu popover la tso wrapper me <div>alo <span>eye yeaɖe asi le pointer-eventson the disabled element la ŋu.

Le popover triggers siwo nye nuwɔametɔwo gome la, àte ŋu alɔ̃ hã data-trigger="hover"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.

<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover">
  <button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button>
</span>

Zãzã

Na popovers nawɔ dɔ to JavaScript dzi:

$('#example').popover(options)
GPU ƒe duƒuƒu

Popovers dzena ɣeaɖewoɣi blurry le Windows 10 dɔwɔnuwo dzi le GPU ƒe ablaɖeɖe kple ɖoɖoa ƒe DPI si woɖɔli ta. Dɔwɔwɔ na esia le v4 me enye be nàwɔ GPU ƒe ablaɖeɖe nuwɔametɔe abe alesi wòhiã ene le wò popovers dzi.

Woɖo aɖaŋu be woaɖɔe ɖo:

Popper.Defaults.modifiers.computeStyle.gpuAcceleration = !(window.devicePixelRatio < 1.5 && /Win/.test(navigator.platform))

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ɔ be nàde nuwɔwɔ ƒe dziɖuɖuwo hã (abe nɔnɔme ƒe akpawo alo kadodowo ene) wò popover me (to nu siawo tsɔtsɔ kpe ɖe whiteListnɔnɔme kple dzesi siwo ŋu woɖe mɔ ɖo alo esiwo ŋu woɖe mɔ ɖo ŋu me) 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

Woateŋu atsɔ tiatiawɔblɔɖewo ato nyatakaka ƒe nɔnɔmewo alo JavaScript dzi. Le nyatakaka ƒe nɔnɔmewo gome la, tsɔ tiatia ƒe ŋkɔ kpe ɖe data-, abe alesi wòle le data-animation="".

De dzesii be le dedienɔnɔ ta la , womate ŋu atsɔ nyatakaka ƒe nɔnɔmewo ana sanitize, sanitizeFnkple tiatiaawo o.whiteList
Ŋkɔ Ƒomevi Gᴐmedzeƒe Nuɖᴐɖᴐ
nɔnɔmetata si me woɖea nɔnɔmetatawo le boolean ƒe ƒuƒoƒo nyateƒe Wɔ CSS fade ƒe tɔtrɔ ɖe popover la ŋu
nugoe me nugoe kaƒoƒo | element | alakpa alakpa

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.

eme nuwo kaƒoƒo | element | wᴐ dᴐ '' .

Default content value ne data-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.

hehe ɖe megbe xexlẽdzesi | nu 0.

Hehe ɖe megbe le popover (ms) ɖeɖefia kple eɣla ɖe megbe - meku ɖe asi trigger ƒomevi ŋu o

Ne wotsɔ xexlẽdzesi aɖe na la, wozãa megbedede ɖe ɣla/ɖee fia siaa ŋu

Nu ƒe wɔwɔme enye:delay: { "show": 500, "hide": 100 }

html boolean ƒe ƒuƒoƒo alakpa De HTML popover la me. Ne alakpae la, woazã jQuery ƒe textmɔnu atsɔ ade emenyawo DOM la me. Zã nuŋɔŋlɔ ne ètsi dzi ɖe XSS ƒe amedzidzedzewo ŋu.
ɖoɖo ɖe teƒe aɖe kaƒoƒo | wᴐ dᴐ 'nyui'

Ale si woaɖo popover la ɖe ɖoɖo nu - auto | dziƒo | ete | miame | nyui.
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.

tiatiawɔla kaƒoƒo | alakpa alakpa 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ɔ naa HTML me nyatakaka siwo trɔna la nate ŋu atsɔ popovers akpe ɖe eŋu. Kpɔ esia kple kpɔɖeŋu si me nyatakaka geɖe le .
ƒe nɔnɔmetata ka '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'

Gɔmeɖoanyi HTML be nàzã ne èle popover la wɔm.

Woado popover titlela ɖe .popover-header.

Woado popover contentla ɖe .popover-body.

.arrowava zu popover la ƒe aŋutrɔ.

Ele be .popoverklass la nanɔ agbalẽ xatsaxatsa ƒe akpa si le gota wu la si.

tanya kaƒoƒo | element | wᴐ dᴐ '' .

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.

daƒe ka 'zi edzi'. Alesi wodzea popover gɔmee - zi | hover | susu tsɔtsɔ ɖo nu ŋu | asi nu. Àte ŋu ato nu geɖe siwo aʋã wò la me; tsɔ dometsotso aɖe ma wo dome. manualwomate ŋu atsɔe akpe ɖe nusi aʋã ame bubu aɖeke ŋu o.
offset ƒe ƒuƒoƒo xexlẽdzesi | ka 0. Offset of the popover ne wotsɔe sɔ kple eƒe taɖodzinu. Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe offset docs .
fallbackNuɖoɖo ɖe teƒe aɖe kaƒoƒo | ƒuƒoƒo ƒe ƒuƒoƒo 'ti kpo' Ðe mɔ be woagblɔ ɖoƒe si Popper azã le fallback me. Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe nuwɔna ŋuti nuŋlɔɖiwo
customClass ƒe ɖoɖo kaƒoƒo | wᴐ dᴐ '' .

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: 'a b'.

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

liƒo dzi kaƒoƒo | na 'agbalẽ xatsaxatsa dzila'. Overflow mɔxenu liƒo na popover. Xɔ 'viewport', 'window', 'scrollParent', alo HTMLElement ƒe nufiame ƒe asixɔxɔwo (JavaScript ɖeɖeko). Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe preventOverflow docs .
tsɔ kɔ na ame boolean ƒe ƒuƒoƒo nyateƒe Na dzadzɛnyenyea nawɔ dɔ alo nàgawɔ dɔ o. If activated 'template', 'content'kple 'title'tiatiawɔblɔɖewo anye sanitized. Kpɔ akpa si nye sanitizer le míaƒe JavaScript nuŋlɔɖiwo me .
whiteList ƒe xexlẽdzesi nu Asixɔxɔ si woɖo ɖi Nusi me nɔnɔme kple dzesi siwo ŋu woɖe mɔ ɖo le
dzadzɛnyenyeFn null | wᴐ dᴐ ƒuƒlu 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ɔ.
popper ƒe Ðoɖowɔɖi null | nu ƒuƒlu Ne èdi be yeatrɔ Bootstrap ƒe Popper ƒe ɖoɖowɔɖi gbãtɔ la, kpɔ Popper ƒe ɖoɖowɔɖi

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.

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 .

$().popover(options)

Edzea popovers gɔme na element nuƒoƒoƒu.

.popover('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.

$('#element').popover('show')

.popover('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.

$('#element').popover('hide')

.popover('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.

$('#element').popover('toggle')

.popover('dispose')

Eɣlaa element aɖe ƒe popover eye wòtsrɔ̃nɛ. Popovers siwo zãa delegation (si wowɔ to tiatia ) zazã me laselector mateŋu atsrɔ̃ ɖekaɖeka le dzidzime ƒe trigger elements dzi o.

$('#element').popover('dispose')

.popover('enable')

Enaa ŋutete si le element aɖe ƒe popover ŋu ​​be woaɖee afia. Wowɔa Popovers ŋudɔ le gɔmedzedzea me.

$('#element').popover('enable')

.popover('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.

$('#element').popover('disable')

.popover('toggleEnabled')

Toggles ŋutete na element ƒe popover be woaɖe afia alo aɣla.

$('#element').popover('toggleEnabled')

.popover('update')

Trɔ asi le element aɖe ƒe popover ƒe nɔƒe ŋu.

$('#element').popover('update')

Nudzɔdzɔwo

Nudzɔdzɔ Ƒomevi Nuɖᴐɖᴐ
ɖee fia.bs.popover Nudzɔdzɔ sia doa dzo enumake ne woyɔ showkpɔɖeŋu mɔnu la.
woɖee fia.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).
ɣla.bs.ahedada Woɖea nudzɔdzɔ sia ɖa enumake ne woyɔ hideinstance mɔnu la.
ɣaɣla.bs.ahedada Woɖea nudzɔdzɔ sia ɖa ne popover la ɣla ɖe zãla la vɔ (alala be CSS ƒe tɔtrɔwo nawu enu).
wotsɔ de eme.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.
$('#myPopover').on('hidden.bs.popover', function () {
  // do something...
})