Baarakɛminɛnw ladilikanw
Sɛbɛnw ni misaliw minnu bɛ kɛ ka Bootstrap baarakɛminɛnw ladamulenw fara ɲɔgɔn kan ni CSS ani JavaScript ye ni CSS3 ye animationw ni data-attributes kama sigida tɔgɔw marali kama.
Fɛn minnu ka kan ka dɔn ni i bɛ baara kɛ ni baarakɛminɛnw ye:
- Baarakɛminɛnw bɛ tali Kɛ 3nan ka gafemarayɔrɔ Popper.js kan jɔyɔrɔko la. Aw ka kan ka popper.min.js don a kɔnɔ ka kɔn bootstrap.js ɲɛ walima ka baara kɛ ni
bootstrap.bundle.min.js
/bootstrap.bundle.js
ye min kɔnɔ Popper.js bɛ yen walasa baarakɛminɛnw ka se ka baara kɛ! - N'i bɛ an ka JavaScript jɔ ka bɔ source la, a bɛ wajibiya
util.js
. - Baarakɛminɛnw ladilikanw ye opt-in ye baarakɛcogo kunw na, o la i yɛrɛ ka kan k’u daminɛ .
- Baarakɛminɛn minnu tɔgɔw janya ye zeru ye, olu tɛ jira abada.
- A jira
container: 'body'
walasa ka i yɛrɛ tanga ɲɛfɔli gɛlɛyaw ma yɔrɔw la minnu ka gɛlɛn kosɛbɛ (i n’a fɔ an ka donnakow kuluw, butɔni kuluw, a ɲɔgɔnnaw). - Baarakɛminɛnw bilali daminɛni fɛn dogolenw kan, o tɛna baara kɛ.
- Baarakɛminɛnw ladilikanw for
.disabled
walimadisabled
elements ka kan ka daminɛ wrapper element kan. - Ni a daminɛna ka bɔ hyperlinkw la minnu bɛ zana caman cɛ, baarakɛminɛnw bɛna kɛ cɛmancɛ la. Aw
white-space: nowrap;
bɛ baara kɛ ni aw ka<a>
s ye walasa ka aw yɛrɛ tanga nin kɛcogo in ma. - Baarakɛminɛnw ka kan ka dogo sani u bɛnkanw ka bɔ DOM kɔnɔ.
I ye o bɛɛ sɔrɔ wa? A ka bon, an k’a lajɛ u bɛ baara kɛ cogo min na ni misali dɔw ye.
Baarakɛminɛnw bɛɛ daminɛcogo dɔ ye ɲɛ dɔ kan o ye k’u sugandi u data-toggle
cogoya fɛ:
I bolo digi jukɔrɔla yɔrɔw kan walasa ka baarakɛminɛnw lajɛ:
Tight pants next level keffiyeh n'a sɔrɔla i ma u mɛn. Foto cabine barbe cru denim letterpress vegan ciden sac stumptown. Foro-ka-tabali seitan, mcsweeney ka fixie sabatilen quinoa 8-bit ameriki finiw bɛ ni terry richardson vinyl chambray ye. Barbu stumptown, cardigans banh mi lomo sanpɛrɛnw. Tofu biodiesel williamsburg marfa, naani loko mcsweeney ka saniya vegan chambray. A tiɲɛ na ironic artisan whatever keytar , scenester foro-ka-tabali banksy Austin twitter bolo freegan cred raw denim kelen-origin kafe viral.
I bolo digi butɔni kan minnu bɛ duguma walasa ka baarakɛminɛnw jiracogo naani ye: sanfɛ, kinin fɛ, duguma ani numan fɛ.
Ani ni HTML ladamulen farala a kan:
Baarakɛminɛnw-kumasenw bɛ kɔnɔkow ni taamasiyɛnw Bɔ ɲinini na, wa a bɛ baarakɛminɛnw bila u ka trigger element kɔfɛ.
Baarakɛminɛn in daminɛ JavaScript fɛ:
Taamaʃyɛn wajibiyalen min bɛ Kɛ baarakɛminɛn dɔ la o ye data
fɛnɲɛnɛma dɔrɔn de ye wa title
HTML yɔrɔ kan i b’a fɛ ka baarakɛminɛn dɔ Sɔrɔ. Baarakɛminɛn dɔ taamasiyɛn min Sɔrɔla o ka nɔgɔn kosɛbɛ, hali n’a bɛ jɔyɔrɔ dɔ de wajibiya (a daminɛ na, a bɛ Blà ‘sèn na top
ni ‘plugin ye).
Baarakɛminɛnw kɛli ka baara kɛ klaviyeti ni dɛmɛni fɛɛrɛw baarakɛlaw ye
I ka kan ka baarakɛminɛnw dɔrɔn de Fàra HTML yɔrɔw kan minnu bɛ Se ka Klaviyeti-yɔrɔ-ko-ɲɛnabɔli Kɛ laada la ani minnu bɛ Se ka Kɛ ɲɔgɔn fɛ (i n’a fɔ jὲɲɔgɔnya walima foroko-kɔlɔsili). Hali ni HTML fɛnw (i n’a fɔ <span>
s) bɛ Se ka Kɛ ‘fɛn ye min bɛ Se ka Kɛ ‘fɛn ye min bɛ Se ka Kɛ ‘fɛn ye min bɛ Se ka Kɛ ‘fɛn ye min bɛ Se ka Kɛ ‘fɛn ye min bɛ Se ka Kɛ ‘fɛn ye min bɛ Se ka ‘ tabindex="0"
kɔnɔnafili ani k’u hakili ɲagami klaviyeti baarakɛlaw kan minnu tɛ ‘ɲɔgɔn ‘kɔnɔ. Ka fara o kan, dɛmɛn fɛɛrɛ fanba tɛ baarakɛminɛnko laseli sisan nin ko in na.
Ka fara o kan, i kana i jigi da dɔrɔn kan hover
i n’a fɔ i ka baarakɛminɛnw labɛncogo, bawo o bɛna a to i ka baarakɛminɛnw tɛ se ka daminɛ klaviyeti baarakɛlaw fɛ.
Fɛn minnu bɛ ni fɛn ye disabled
, olu tɛ ɲɔgɔndan ye, o kɔrɔ ye ko baarakɛlaw tɛ Se k’u sinsin, k’u jɔ, walima k’u digi walasa ka baarakɛminɛn dɔ (walima popover) dɔ Daminɛ. O cogo la, i b’a fɛ ka baarakɛminɛnw daminɛ ka bɔ wrapper <div>
walima <span>
, ideally made keyboard-focusable using tabindex="0"
, ani ka override the pointer-events
on the disabled element.
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" title="Disabled tooltip">
<button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button>
</span>
Sugandili bɛ se ka tɛmɛ data attributes walima JavaScript fɛ. Donanw cogoyaw kama, aw bɛ sugandi tɔgɔ fara data-
, i n’a fɔ a bɛ cogo min na data-animation=""
.
Tɔ̀gɔ | Ka sɛbɛen masin na | Fɔlɔ | Cogojirali |
---|---|---|---|
animation (ɲɛnamaya kɛcogo ɲuman). | boolean ye | sɛbɛ | CSS fade transition (CSS fade transition) dɔ kɛ baarakɛminɛnw yɔrɔ la |
minɛn kɔnɔ | juru | element | nkalon | nkalon | A bɛ baarakɛminɛnw ɲɛfɔli fara fɛn kɛrɛnkɛrɛnnen dɔ kan. Misali la: |
ka mɛ | jate | minɛn | 0 ye | Baarakɛminɛnw jiracogo ni a dogocogo latɛmɛni (ms) - o tɛ tali kɛ bololabaarakɛminɛn suguya la Ni nimɔrɔ dɔ dira, delay bɛ kɛ hide/show fila bɛɛ la Fɛnw jɔcogo ye: |
html ye | boolean ye | nkalon | Aw bɛ HTML to baarakɛminɛnw kɔnɔ. Ni tiɲɛ don, HTML taamasiyɛn minnu bɛ baarakɛminɛnw kɔnɔ, Baara kɛ ni sɛbɛnni ye ni i bɛ hami XSS binkanniw na. |
bilali sen kan | juru | baarakunda | 'san fɛ' | Baarakɛminɛnw bilacogo - auto | sanfɛ | duguma | kinin fɛ | jo. Ni baarakɛcogo dɔ bɛ Kɛ ka yɔrɔ-yɔrɔ-ko Labɛn, a bɛ Weele ni baarakɛminɛn-sɛbɛn DOM node ye a ka dalilu fɔlɔ ye ani 'fɛn min bɛ Daminɛ DOM node ye k'o Kɛ a filanan ye. A |
sugandilikɛla | juru | nkalon | nkalon | Ni sugandili dɔ dira, baarakɛminɛnw ɲɛfɔli fɛnw bɛna di laɲini kofɔlenw ma. Tiɲɛ na, o bɛ Kɛ walasa ka HTML kɔnɔkow dinamikilenw Dɛmɛ ka popovers (popovers) Fàra u kan. Aw ye nin lajɛ ani misali min bɛ kunnafoni di . |
jatebɔlan | gaari | '<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>' |
Base HTML ka baara kɛ ni baarakɛminɛnw ɲɛfɔli ye. Baarakɛminɛnw
Kɛnɛma dakun ka kan ka kɛ ni |
titiri | juru | element | baarakunda | '' '' . | Title nafa dafalen ni Ni baarakɛcogo dɔ dira, a bɛ Weele n'a ka |
ka ci | gaari | 'hover focus' ye. | Baarakɛminɛnw ɲɛfɔli bɛ daminɛ cogo min na - i ka | digi hover | sinsinnan | min bɛ fɛn bolo la. Aw bɛ se ka tɛmɛ fɛn caman kan minnu bɛ se ka kɛ sababu ye; u faranfasi ni yɔrɔ ye.
|
offset (fɔcogo ɲuman). | jate | gaari | 0 ye | Offset of the tooltip ka kɛɲɛ n’a laɲini ye. Walasa ka kunnafoni wɛrɛw sɔrɔ, aw ye Popper.js ka offset docs lajɛ . |
fallbackBɔli | juru | array (ɲɛnajɛ). | 'kilape' | A to k’a jira Popper bɛna baara kɛ ni jɔyɔrɔ min ye fallback kan. Walasa ka kunnafoni wɛrɛw sɔrɔ, aw ye Popper.js ka kɛwale sɛbɛnw lajɛ |
dankan | juru | fɛn | 'sɛbɛnni Bangebagaw'. | Overflow constraint dancɛ min bɛ baarakɛminɛnw na. A bɛ Sɔn 'viewport' , 'window' , 'scrollParent' , walima HTMLElement ɲɛfɔli dɔ nafaw ma (JavaScript dɔrɔn). Walasa ka kunnafoni wɛrɛw sɔrɔ, aw ye Popper.js ka preventOverflow docs lajɛ . |
Donanw cogoyaw ka ɲɛsin baarakɛminɛn kelen-kelen bɛɛ ma
Sugandili minnu bɛ kɛ baarakɛminɛn kelen-kelen bɛɛ la, olu bɛ se ka ɲɛfɔ cogo wɛrɛ la ni kunnafonidilanw cogoyaw ye, i n’a fɔ a ɲɛfɔlen don cogo min na sanfɛ.
Fɛɛrɛ minnu tɛ kelen ye ani fɛn caman tigɛli
API fɛɛrɛw bɛɛ ye asynchrone ye ani ka tɛmɛsira dɔ daminɛ . u bɛ segin welebaga ma ni wuli daminɛna dɔrɔn nka sanni a ka ban . Ka fara o kan, fɛɛrɛ weleli min bɛ kɛ tɛmɛsira yɔrɔ dɔ kan, o bɛna jate .
Aw ye an ka JavaScript sɛbɛnw lajɛ walasa ka kunnafoni wɛrɛw sɔrɔ.
A bɛ baarakɛminɛn dɔ nɔrɔ fɛnw lajɛlen dɔ la.
A bɛ element dɔ ka baarakɛminɛnw jira. A bɛ Segin welebaga ma sani baarakɛminɛn in ka jira tiɲɛ na (o kɔrɔ ye ko sani ko shown.bs.tooltip
in ka Kɛ). O bɛ jate baarakɛminɛnw ɲɛfɔli “bololanɛgɛ” daminɛni ye. Baarakɛminɛn minnu tɔgɔw janya ye zeru ye, olu tɛ jira abada.
A bɛ fɛn dɔ ka baarakɛminɛn dɔ dogo. A bɛ Segin welebaga ma sani baarakɛminɛn in ka dogo tiɲɛ na (o kɔrɔ ye ko sani ko hidden.bs.tooltip
in ka Kɛ). O bɛ jate baarakɛminɛnw ɲɛfɔli “bololanɛgɛ” daminɛni ye.
A bɛ fɛn dɔ ka baarakɛminɛnw sɛgɛsɛgɛli wuli. A bɛ Segin welebaga ma sani baarakɛminɛn in ka jira tiɲɛ na walima ka dogo (o kɔrɔ ye ko sanni shown.bs.tooltip
walima hidden.bs.tooltip
ko kɛlen ka Kɛ). O bɛ jate baarakɛminɛnw ɲɛfɔli “bololanɛgɛ” daminɛni ye.
A bɛ fɛn dɔ ka baarakɛminɛn dɔ dogo ani k’a Tiɲɛ. Baarakɛminɛn minnu bɛ baara Kɛ ni delegation ye (minnu bɛ Dabɔ ni option selector
ye ) tɛ Se ka Tiɲɛ kelen-kelen bɔnsɔn trigger elements kan.
A bɛ se di fɛn dɔ ka baarakɛminɛnw ma ka se ka jira. Baarakɛminɛnw ladilikanw bɛ baara kɛ ka daminɛ.
A bɛ seko bɔ fɛn dɔ ka baarakɛminɛnw jiracogo la. Baarakɛminɛnw ɲɛfɔli bɛna se ka jira dɔrɔn ni a daminɛna kokura.
A bɛ seko caman wuli walasa fɛn dɔ ka baarakɛminɛnw ka jira walima ka dogo.
A bɛ fɛn dɔ ka baarakɛminɛnw jɔyɔrɔ sɛmɛntiya.
Ko kɛlen suguya | Cogojirali |
---|---|
jira.bs.baarakɛminɛnw | O ko in bɛ tasuma Bɔ o yɔrɔnin bɛɛ ni show misali fɛɛrɛ Weelera. |
jiralen.bs.baarakɛminɛnw | O ko in bɛ Bɔ ni baarakɛminɛnw ɲɛfɔli Kɛra baarakɛla fɛ (a bɛna CSS 'tɛmɛsiraw makɔnɔ u ka ban). |
dogo.bs.baarakɛminɛnw ɲɛfɔli | O ko in bɛ Fɔ o yɔrɔnin bɛɛ ni hide misali fɛɛrɛ Weelera. |
dogolen.bs.baarakɛminɛnw ɲɛfɔli | O ko in bɛ Fɔ ni baarakɛminɛnw dogolen ye baarakɛla la (a bɛna CSS 'tɛmɛsiraw makɔnɔ u ka ban). |
inserted.bs.baarakɛminɛnw ɲɛfɔli | O ko in bɛ Bɔ ko kɛlen kɔfɛ show.bs.tooltip ni baarakɛminɛnw jatebɔlan Fàrala DOM kan. |