Dɔwɔnu ƒe Aɖaŋuɖoɖowo
Nuŋlɔɖiwo kple kpɔɖeŋuwo hena Bootstrap dɔwɔnu ƒe aɖaŋuɖoɖo tɔxɛwo tsɔtsɔ kpe ɖe eŋu kple CSS kple JavaScript to CSS3 zazã me na nɔnɔmetatawo kple nyatakaka-nɔnɔmewo na teƒea ƒe tanya dzraɖoƒe.
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 3rd party agbalẽdzraɖoƒe Popper.js ŋu hena teƒeɖoɖo. Ele be nàde popper.min.js hafi bootstrap.js alo nàzã
bootstrap.bundle.min.js
/bootstrap.bundle.js
si me Popper.js le hafi dɔwɔnu ƒe aɖaŋuɖoɖowo nawɔ dɔ! - Ne èle míaƒe JavaScript tum tso dzɔtsoƒe la, ebia be
util.js
. - 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.
.disabled
Ele be woaʋu dɔwɔnu ƒe aɖaŋuɖoɖowo na alo elementwo ɖedisabled
wrapper 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.
Nu mawo katã le asiwòa? Gã, na míakpɔ alesi wowɔa dɔe kple kpɔɖeŋu aɖewo ɖa.
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-toggle
nɔnɔme nu:
Tsɔ asi ɖo kadodo siwo le ete la dzi be nàkpɔ dɔwɔnu ƒe aɖaŋuɖoɖowo:
Tight pants next level keffiyeh ɖewohĩ mèse wo ŋkɔ kpɔ o. Fotoɖeƒe ɖaɖa raw denim letterpress vegan dɔla kotoku stumptown. Agble-to-kplɔ̃ seitan, mcsweeney ƒe fixie si li tegbee quinoa 8-bit american awuwo le terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo dziɖegbe ƒe avuwo. Tofu biodiesel williamsburg marfa, ene loko mcsweeney ƒe kɔ vegan chambray. A really ironic artisan whatever keytar , scenester agble-ɖe-kplɔ̃ banksy Austin twitter asi freegan cred raw denim ɖeka-dzɔtsoƒe kɔfi viral.
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.
Eye esi wotsɔ HTML si wowɔ ɖe ɖoɖo nu kpe ɖe eŋu la:
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:
Overflow auto
kplescroll
Dɔwɔnu ƒe dzesi ƒe nɔƒe dzea agbagba be yeatrɔ le eɖokui si ne dzila ƒe nugoe aɖe le overflow: auto
alo overflow: scroll
abe míaƒe .table-responsive
, gake egaléa teƒe gbãtɔ ƒe nɔƒe ɖe te kokoko. Be nàkpɔ egbɔ la, ɖo boundary
tiatia la ɖe nusianu si menye asixɔxɔ gbãtɔ o, 'scrollParent'
, abe 'window'
:
Dzesi si hiã na dɔwɔnu ƒe aɖaŋuɖoɖo nye data
nɔnɔme aɖe ko eye title
le 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 top
to 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ɔ 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. Tsɔ kpe ɖe eŋu la, kpekpeɖeŋunamɔnu akpa gãtɔ meɖea gbeƒã dɔwɔnu ƒe aɖaŋuɖoɖoa fifia le nɔnɔme sia me o.
Tsɔ kpe ɖe eŋu la, mègaɖo ŋu ɖe eŋu ɖeɖeko hover
be 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.
Elements siwo si disabled
nɔ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 dɔwɔwɔ ene la, àdi be yeaʋu dɔwɔnu ƒe aɖaŋuɖoɖoa tso agbalẽ xatsaxatsa <div>
alo <span>
, si wowɔ nyuie be woate ŋu atsɔ keyboard-focusable zã tabindex="0"
, eye yeaɖe asi le pointer-events
on the disabled element la ŋu.
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=""
.
Ŋ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 dɔwɔnu ƒe aɖaŋuɖoɖoa dzi |
nugoe me nugoe | kaƒoƒo | element | alakpa | alakpa | Tsɔ dɔwɔnu ƒe aɖaŋuɖoɖoa kpe ɖe nu aɖe koŋ ŋu. Kpɔɖeŋu: |
hehe ɖe megbe | xexlẽdzesi | nu | 0. | Hehe ɖe megbe le dɔwɔnu ƒe aɖaŋuɖoɖo ɖeɖefia kple eɣla ɖe megbe (ms) - meku ɖe asi ƒe ʋuʋu ƒ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: |
html | boolean ƒe ƒuƒoƒo | alakpa | Ð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 Zã nuŋɔŋlɔ ne ètsi dzi ɖe XSS ƒe amedzidzedzewo ŋu. |
ɖoɖo ɖe teƒe aɖe | kaƒoƒo | wᴐ dᴐ | 'dzi' | Alesi woaɖo dɔwɔnu ƒe aɖaŋuɖoɖoa ɖe teƒe - auto | dziƒo | ete | miame | nyui. 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 |
tiatiawɔla | kaƒoƒo | alakpa | alakpa | 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ɔ 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="tooltip" role="tooltip"><div class="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
Ele be |
tanya | kaƒoƒo | element | wᴐ dᴐ | '' . | Tanya ƒe asixɔxɔ gbãtɔ ne Ne wotsɔ dɔwɔwɔ aɖe na la, woayɔe kple eƒe |
daƒe | ka | 'hover focus'. | Alesi woadze dɔwɔnu ƒe aɖaŋuɖoɖo 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.
|
offset ƒe ƒuƒoƒo | xexlẽdzesi | ka | 0. | Dɔwɔnu ƒe aɖaŋuɖoɖo ƒe vovototodedeameme ne wotsɔe sɔ kple eƒe taɖodzinu. Ne èdi nyatakaka bubuwo la, kpɔ Popper.js ƒ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.js ƒe nuwɔna ŋuti nuŋlɔɖiwo |
liƒo dzi | kaƒoƒo | na | 'agbalẽ xatsaxatsa dzila'. | Overflow mɔxenu liƒo na dɔwɔnu ƒe aɖaŋuɖoɖo. Xɔ 'viewport' , 'window' , 'scrollParent' , alo HTMLElement ƒe nufiame ƒe asixɔxɔwo (JavaScript ɖeɖeko). Ne èdi nyatakaka bubuwo la, kpɔ Popper.js ƒe preventOverflow docs . |
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.
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 .
Kpe dɔwɔnu ƒe aɖaŋuɖoɖo ƒe asiléƒe ɖe element ƒe nuƒoƒoƒu ŋu.
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.tooltip
nudzɔ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.
Ɣ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.tooltip
nudzɔdzɔa nadzɔ). Wobua esia be enye dɔwɔnu ƒe aɖaŋuɖoɖoa ƒe “asi” ƒe dɔwɔwɔ.
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.tooltip
alo hidden.bs.tooltip
nudzɔdzɔa nadzɔ). Wobua esia be enye dɔwɔnu ƒe aɖaŋuɖoɖoa ƒe “asi” ƒe dɔwɔwɔ.
Eɣlaa element aɖe ƒe dɔwɔnu ƒe aɖaŋuɖoɖo eye wòtsrɔ̃nɛ. 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.
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.
Ð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.
Trɔ ŋutete si le element ƒe dɔwɔnu ƒe aɖaŋuɖoɖo ŋu be woaɖee afia alo aɣla.
Trɔ asi le element aɖe ƒe dɔwɔnu ƒe aɖaŋuɖoɖo ƒe nɔƒe ŋu.
Nudzɔdzɔ Ƒomevi | Nuɖᴐɖᴐ |
---|---|
show.bs.dɔwɔnu ƒe aɖaŋuɖoɖo | Nudzɔdzɔ sia doa dzo enumake ne woyɔ show kpɔɖeŋu mɔnu la. |
woɖee fia.bs.dɔwɔnu ƒe aɖaŋuɖoɖo | Woɖea nudzɔdzɔ sia ɖa ne wowɔ dɔwɔnu ƒe aɖaŋuɖoɖoa be wòadze na zãla (alala be CSS ƒe tɔtrɔwo nawu enu). |
hide.bs.dɔwɔnu ƒe aɖaŋuɖoɖo | Woɖea nudzɔdzɔ sia ɖa enumake ne woyɔ hide instance mɔnu la. |
hidden.bs.dɔwɔnu ƒe aɖaŋuɖoɖo | Woɖea nudzɔdzɔ sia ɖa ne dɔwɔnu ƒe aɖaŋuɖoɖoa ɣla ɖe zãla la vɔ (alala be CSS ƒe tɔtrɔwo nawu enu). |
inserted.bs.dɔwɔnu ƒe aɖaŋuɖoɖo | Woɖea nudzɔdzɔ sia ɖa le nudzɔdzɔa megbe show.bs.tooltip ne wotsɔ dɔwɔnu ƒe aɖaŋuɖoɖo ƒe nɔnɔmetata kpe ɖe DOM ŋu. |