Switsundzuxo swa Switirhisiwa
Matsalwa na swikombiso swo engetela switsundzuxo swa switirhisiwa swa Bootstrap swa ntolovelo hi CSS na JavaScript hi ku tirhisa CSS3 eka swifaniso leswi hanyaka na data-bs-attributes ya vuhlayiselo bya swihloko swa laha kaya.
Nkatsakanyo
Swilo leswi u faneleke u swi tiva loko u tirhisa xiengetelo xa xitirhisiwa:
- Switirhisiwa swi titshege hi layiburari ya munhu wa vunharhu Popper eka xiyimo. U fanele ku katsa popper.min.js emahlweni ka
bootstrap.js
, kutani u tirhisabootstrap.bundle.min.js
leyi nga na Popper. - Switsundzuxo swa switirhisiwa i ku hlawula ku nghena hikwalaho ka swivangelo swa matirhelo, hikwalaho u fanele ku swi sungula hi wexe .
- Switsundzuxo swa switirhisiwa leswi nga ni swihloko swa ku leha ka zero a swi si tshama swi kombisiwa.
- Boxa
container: 'body'
ku papalata swiphiqo swa ku hundzuluxela eka swiphemu leswi rharhanganeke swinene (ku fana na mintlawa ya hina ya ku nghenisa, mintlawa ya swikomba-nkarhi, na swin’wana). - Ku hlohlotela switsundzuxo eka swiaki leswi fihliweke a swi nge tirhi.
- Switsundzuxo swa switirhisiwa swa
.disabled
kumbedisabled
swiaki swi fanele ku pfuriwa eka elemente ya xifunengeto. - Loko yi pfuriwa ku suka eka ti-hyperlink leti hlanganisaka milayeni yo tala, switsundzuxo swa switirhisiwa swi ta va swi ri exikarhi. Tirhisa
white-space: nowrap;
eka s ya wena<a>
ku papalata mahanyelo lawa. - Switsundzuxo swa switirhisiwa swi fanele ku fihliwa swiaki swa swona leswi fambelanaka swi nga si susiwa eka DOM.
- Switirhisiwa swi nga pfuriwa hi ku khensa elemente endzeni ka DOM ya ndzhuti.
Xana u na swona hinkwaswo sweswo? Great, a hi voneni ndlela leyi va tirhaka ha yona hi swikombiso swin’wana.
prefers-reduced-motion
xivutiso xa midiya. Vona
xiyenge xa ku famba loku hungutiweke xa matsalwa ya hina ya ku fikelela .
Swikombiso
Endla leswaku switsundzuxo swa switirhisiwa swi tirha
Hilaha swi boxiweke hakona laha henhla, u fanele ku sungula switsundzuxo swa switirhisiwa swi nga si tirhisiwa. Ndlela yin’wana yo sungula switsundzuxo hinkwaswo swa switirhisiwa eka tluka ku nga va ku swi hlawula hi data-bs-toggle
xihlawulekisi xa swona, ku fana na sweswo:
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
Switsundzuxo swa switirhisiwa eka swihlanganisi
Hover ehenhla ka swihlanganisi leswi nga laha hansi ku vona switsundzuxo swa switirhisiwa:
Tsalwa ra xikhomela-ndhawu ku kombisa swihlanganisi swin’wana swa le ndzeni ka layini hi switsundzuxo swa switirhisiwa. Leswi sweswi i filler ntsena, ku hava mudlayi. Vuxokoxoko byi vekiwile laha ntsena ku tekelela vukona bya tsalwa ra xiviri . Naswona hinkwaswo sweswo ntsena ku ku nyika mianakanyo ya ndlela leyi switsundzuxo swa switirhisiwa swi nga langutekaka ha yona loko swi tirhisiwa eka swiyimo swa xiviri. Kutani hi tshemba leswaku sweswi u vonile ndlela leyi switsundzuxo leswi eka swihlanganisi swi nga tirhaka ha yona hi ku tirhisa, loko se u swi tirhisa eka sayiti kumbe phurojeke ya wena .
<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>
title
kumbe
data-bs-title
eka HTML ya wena. Loko
title
yi tirhisiwa, Popper yi ta yi siva hi yoxe hi
data-bs-title
loko elemente yi hundzuluxeriwa.
Switsundzuxo swa switirhisiwa swa ntolovelo
Ku engeteriwe eka v5.2.0U nga cinca ku languteka ka switsundzuxo swa switirhisiwa hi ku tirhisa swilo leswi cinca-cincaka swa CSS . Hi veka tlilasi ya ntolovelo na data-bs-custom-class="custom-tooltip"
ku scope xivumbeko xa hina xa ntolovelo ivi hi yi tirhisa ku tlula xihlawulekisi xa CSS xa laha kaya.
.custom-tooltip {
--bs-tooltip-bg: var(--bs-primary);
}
<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>
Swiletelo
Hover ehenhla ka swikomba-nkarhi leswi nga laha hansi leswaku u vona swiletelo swa mune swa switsundzuxo swa switirhisiwa: ehenhla, exineneni, ehansi ni le ximatsi. Swiletelo swi kombisiwa hi xivoni loko u tirhisa Bootstrap eka RTL.
<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>
Naswona hi HTML ya ntolovelo leyi engeteriweke:
<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>
Hi SVG: .
CSS
Swilo leswi cinca-cincaka
Ku engeteriwe eka v5.2.0Tanihi xiphemu xa endlelo ra Bootstrap leri cincaka ra swilo leswi cinca-cincaka swa CSS, switsundzuxo swa switirhisiwa sweswi swi tirhisa swilo leswi cinca-cincaka swa CSS swa laha kaya on .tooltip
for enhanced real-time customization. Mimpimo ya swilo leswi cinca-cincaka swa CSS yi vekiwile hi ku tirhisa Sass, kutani ku cinca ka Sass ka ha seketeriwa, na kona.
--#{$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 swilo leswi cinca-cincaka
$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
Matirhiselo
Plugin ya xitsundzuxo xa switirhisiwa yi humesa nhundzu na ku fungha hi ku landza xilaveko, naswona hi ku tiyimisela yi veka switsundzuxo endzhaku ka elemente ya swona ya xihlohloteri.
Pfuxeta xitsundzuxo xa xitirhisiwa hi ku tirhisa JavaScript:
const exampleEl = document.getElementById('example')
const tooltip = new bootstrap.Tooltip(exampleEl, options)
Ku tala ka mati auto
nascroll
Xiyimo xa xitirhisiwa xi ringeta ku cinca hi ku tisungulela loko xikhomela-ndhawu xa mutswari xi ri na overflow: auto
kumbe overflow: scroll
ku fana na xa hina .table-responsive
, kambe xa ha hlayisa xiyimo xa ndhawu yo sungula. Ku lulamisa leswi, veka boundary
nhlawulo (eka mucinci wa flip hi ku tirhisa popperConfig
nhlawulo) eka HTMLElement yihi na yihi ku tlula ntikelo wa xiviri, 'clippingParents'
, ku fana na document.body
:
const tooltip = new bootstrap.Tooltip('#example', {
boundary: document.body // or document.querySelector('#boundary')
})
Ku fungha swilo
Ximaki lexi lavekaka xa xitsundzuxo xa xitirhisiwa i data
xihlawulekisi ntsena naswona title
eka elemente ya HTML u navela ku va na xitsundzuxo xa xitirhisiwa. Ku fungha loku endliweke ka xitsundzuxo xa xitirhisiwa ku olovile swinene, hambi leswi ku lavaka xiyimo (hi ku tiyimisela, ku vekiwile eka top
hi xiengetelo).
Ku endla leswaku switsundzuxo swi tirha eka vatirhisi va khibhodi na thekinoloji yo pfuneta
U fanele ku engetela ntsena switsundzuxo swa switirhisiwa eka swiaki swa HTML leswi hi ntolovelo swi kongomisiweke eka khibhodi na ku tirhisana (ku fana na swihlanganisi kumbe vulawuri bya fomo). Hambileswi swiaki swa HTML swa ku tihlawulela (swo tanihi <span>
s) swi nga endliwaka swi kongomisiwa hi ku engetela tabindex="0"
xihlawulekisi, leswi swi ta engetela ku yima ka tithebhu loku nga ha hlundzukisaka ni ku pfilunganya eka swiaki leswi nga riki swa vuhlanganisi eka vatirhisi va khibhodi, naswona thekinoloji yo tala leyi pfunaka sweswi a yi tivisi xitsundzuxo xa xitirhisiwa eka xiyimo lexi. Ku engetela kwalaho, u nga titshegi ntsena hi hover
tanihi xihlohloteri xa xitsundzuxo xa wena xa switirhisiwa, tanihi leswi leswi swi nga ta endla leswaku switsundzuxo swa wena swi nga koteki ku swi hlohlotela eka vatirhisi va khibhodi.
<!-- 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>
Swiaki leswi lamaleke
Swiaki leswi nga na disabled
xihlawulekisi a swi tirhisani, leswi vulaka leswaku vatirhisi a va nge swi koti ku kongomisa, ku hover, kumbe ku swi tsindziyela ku pfuxa xitirhisiwa (kumbe popover). Tanihi ndlela yo tshungula, u ta lava ku pfuxa xitsundzuxo xa xitirhisiwa ku suka eka xifunengeto <div>
kumbe <span>
, hi ndlela leyinene yi endliwe leswaku yi kongomisiwa eka khibhodi hi ku tirhisa tabindex="0"
.
<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>
Swihlawulekisi
Tanihi leswi swihlawulekisi swi nga hundziseriwaka hi ku tirhisa swihlawulekisi swa data kumbe JavaScript, u nga engetela vito ra xihlawulekisi eka data-bs-
, tanihi le ka data-bs-animation="{value}"
. Tiyisisa leswaku u cinca muxaka wa xiyimo xa vito ra xihlawulekisi ku suka eka “ camelCase ” ku ya eka “ kebab-case ” loko u hundzisa swihlawulekisi hi ku tirhisa swihlawulekisi swa data. Hi xikombiso, tirhisa data-bs-custom-class="beautifier"
ematshan’weni ya data-bs-customClass="beautifier"
.
Ku sukela eka Bootstrap 5.2.0, swiphemu hinkwaswo swi seketela xihlawulekisi xa datha leyi hlayisiweke ya xikambelodata-bs-config
lexi nga vekaka vukorhokeri byo olova bya xiphemu tanihi ntambhu ya JSON. Loko elemente yi ri data-bs-config='{"delay":0, "title":123}'
na na data-bs-title="456"
swihlawulekisi, title
ntikelo wo hetelela wu ta va 456
naswona swihlawulekisi swa datha leswi hambaneke swi ta tlula mimpimo leyi nyikiweke eka data-bs-config
. Ku engetela kwalaho, swihlawulekisi swa datha leswi nga kona swi kota ku veka mimpimo ya JSON ku fana na data-bs-delay='{"show":0,"hide":150}'
.
sanitize
,
sanitizeFn
, na
allowList
swihlawulekisi a swi nge nyikiwi hi ku tirhisa swihlawulekisi swa data.
Vito | Muxaka | Ku tlula | Nhlamuselo |
---|---|---|---|
allowList |
nchumu | Nhlayo ya xiviri | Nchumu lowu nga na swihlawulekisi leswi pfumeleriweke na tithegi. |
animation |
xitsonga xitsonga | true |
Tirhisa ku cinca ka ku fada ka CSS eka xitsundzuxo xa xitirhisiwa. |
boundary |
ntambhu, xiaki | 'clippingParents' |
Ndzilakano wa xipimelo xa ku khuluka wa xitsundzuxo xa xitirhisiwa (wu tirha ntsena eka mucinci wa Popper wa preventOverflow). Hi ku tiyimisela, yi 'clippingParents' na naswona yi nga amukela xikombo xa HTMLElement (hi ku tirhisa JavaScript ntsena). Ku kuma vuxokoxoko byo tala languta eka Popper's detectOverflow docs . |
container |
ntambhu, xiaki, mavunwa | false |
Ku engetela xitsundzuxo xa xitirhisiwa eka elemente yo karhi. Xikombiso: container: 'body' . Nhlawulo lowu wu pfuna ngopfu hikuva wu ku pfumelela ku veka xitsundzuxo xa xitirhisiwa eka ku khuluka ka tsalwa ekusuhi na xiaki lexi pfuxaka - leswi nga ta sivela xitsundzuxo xa xitirhisiwa ku papamala ekule na xiaki xo hlohlotela hi nkarhi wa ku cinca sayizi ya fasitere. |
customClass |
ntambhu, ntirho | '' |
Engetela titlilasi eka xitsundzuxo xa switirhisiwa loko xi kombisiwa. Xiya leswaku titlilasi leti ti ta engeteriwa ku engetela eka titlilasi tihi na tihi leti boxiweke eka xifaniso. Ku engetela titlilasi to tala, ti hambanise hi swivandla: 'class-1 class-2' . U nga ha tlhela u hundzisela ntirho lowu faneleke ku vuyisa ntambhu yin’we leyi nga na mavito ya titlilasi yo engetela. |
delay |
nomboro, nchumu | 0 |
Ku hlwela ku kombisa na ku tumbeta xitsundzuxo xa xitirhisiwa (ms)—a swi tirhi eka muxaka wa manual trigger. Loko nomboro yi nyikiwile, ku hlwela ku tirhisiwa eka havumbirhi bya ku fihla/kombisa. Xivumbeko xa nchumu i: delay: { "show": 500, "hide": 100 } . |
fallbackPlacements |
array ya xirhendzevutani | ['top', 'right', 'bottom', 'left'] |
Hlamusela swivandla swa fallback hi ku nyika nxaxamelo wa swivandla eka array (hi ku landzelelana ka ku tsakela). Ku kuma vuxokoxoko byo tala languta eka Popper's behavior docs . |
html |
xitsonga xitsonga | false |
Pfumelela HTML eka xitsundzuxo xa switirhisiwa. Loko ku ri ntiyiso, tithegi ta HTML eka tooltip's title ti ta kombisiwa eka tooltip. Loko ku ri mavunwa, innerText nhundzu yi ta tirhisiwa ku nghenisa nhundzu eka DOM. Tirhisa tsalwa loko u vilerisiwa hi nhlaselo wa XSS. |
offset |
array, ntambhu, ntirho | [0, 0] |
Ku hambanisiwa ka xitsundzuxo xa xitirhisiwa loko xi pimanisiwa na xikongomelo xa xona. U nga hundzisa ntambhu eka swihlawulekisi swa datha hi mimpimo leyi hambanisiweke hi khoma ku fana na: data-bs-offset="10,20" . Loko ntirho wu tirhisiwa ku kumisisa offset, wu vitaniwa hi nchumu lowu nga na popper placement, reference, na popper rects tani hi argument ya wona yo sungula. Node ya DOM ya elemente leyi hlohlotelaka yi hundziseriwa tanihi argument ya vumbirhi. Ntirho wu fanele ku vuyisa array leyi nga na tinomboro timbirhi: skidding , distance . Ku kuma vuxokoxoko byo tala languta eka Popper's offset docs . |
placement |
ntambhu, ntirho | 'top' |
Ndlela yo veka xitirhisiwa: auto, ehenhla, ehansi, eximatsini, exineneni. Loko auto swi boxiwile, yi ta tlhela yi kongomisa xitsundzuxo xa xitirhisiwa hi ndlela leyi cinca-cincaka. Loko ntirho wu tirhisiwa ku kumisisa ku vekiwa, wu vitaniwa hi tooltip DOM node tanihi argument ya wona yo sungula na triggering element DOM node tanihi ya vumbirhi. Mongo this wu vekiwile eka xikombiso xa xitirhisiwa. |
popperConfig |
null, nchumu, ntirho | null |
Ku cinca xivumbeko xa Popper xa xiviri xa Bootstrap, vona xivumbeko xa Popper . Loko ntirho wu tirhisiwa ku tumbuluxa xivumbeko xa Popper, wu vitaniwa hi nchumu lowu nga na xivumbeko xa Popper xa xiviri xa Bootstrap. Swi ku pfuna ku tirhisa ni ku hlanganisa leswi nga riki swa xiviri ni xivumbeko xa wena. Ntirho wu fanele ku vuyisa nchumu wa vuhlanganisi bya Popper. |
sanitize |
xitsonga xitsonga | true |
Endla leswaku ku tirhisiwa kumbe ku tshikisa ku basisiwa. If activated 'template' , 'content' na 'title' swihlawulekisi swi ta sanitized. |
sanitizeFn |
null, ntirho | null |
Laha unga phakela ntirho wa wena wa sanitize. Leswi swinga pfuna loko u tsakela ku tirhisa layiburari leyi tinyiketeleke ku endla ku basisiwa. |
selector |
ntambhu, mavunwa | false |
Loko ku nyikiwile xihlawulekisi, swilo swa xitsundzuxo xa switirhisiwa swi ta nyikiwa swikongomelo leswi boxiweke. Hi ku tirhisa, leswi swi tirhisiwa ku tlhela swi tirhisa switsundzuxo swa switirhisiwa eka swiaki swa DOM leswi engeteriweke hi ndlela leyi cinca-cincaka ( jQuery.on nseketelo). Vona nkandziyiso lowu ni xikombiso lexi dyondzisaka . |
template |
ntambu | '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
Base HTML ku tirhisa loko u endla xitirhisiwa. Ti tooltip's title ti ta cheriwa eka .tooltip-inner . .tooltip-arrow yi ta va museve wa xitirhisiwa. Xiphemu xa le handle xa xifunengeto xi fanele ku va na .tooltip tlilasi na role="tooltip" . |
title |
ntambhu, xiaki, ntirho | '' |
Nhlayo ya xihloko xa xiviri loko title xihlawulekisi xi nga ri kona. Loko ntirho wu nyikiwile, wu ta vitaniwa hi this sete ya wona ya xikombo eka elemente leyi popover yi khomanisiweke na yona. |
trigger |
ntambu | 'hover focus' |
Ndlela leyi xitirhisiwa xi pfuriwaka ha yona: click, hover, focus, manual. U nga ha hundza swihlohloteri swo tala; va hambanise hi xivandla. 'manual' yi kombisa leswaku xitsundzuxo xa xitirhisiwa xi ta pfuriwa hi phurogireme hi ku tirhisa .tooltip('show') , .tooltip('hide') na .tooltip('toggle') tindlela; ntikelo lowu a wu nge hlanganisiwi na xihlohloteri xin’wana. 'hover' hi yoxe swi ta endla leswaku ku va na switsundzuxo swa switirhisiwa leswi nga pfuriwiki hi ku tirhisa khibhodi, naswona swi fanele ku tirhisiwa ntsena loko tindlela tin’wana to hundzisela rungula leri fanaka eka vatirhisi va khibhodi ti ri kona. |
Swihlawulekisi swa datha swa switsundzuxo swa switirhisiwa swa munhu hi xiyexe
Swihlawulekisi swa switsundzuxo swa switirhisiwa swa munhu hi xiyexe swi nga boxiwile hi ndlela yin’wana hi ku tirhisa swihlawulekisi swa datha, tanihilaha swi hlamuseriweke hakona laha henhla.
Ku tirhisa ntirho napopperConfig
const tooltip = new bootstrap.Tooltip(element, {
popperConfig(defaultBsPopperConfig) {
// const newPopperConfig = {...}
// use defaultBsPopperConfig if needed...
// return newPopperConfig
}
})
Maendlelo
Maendlelo ya asynchronous na ku cinca
Maendlelo hinkwawo ya API i ya asynchronous naswona ya sungula ku cinca . Va tlhelela eka mufoyini hi ku hatlisa loko ku cinca ku sungurile kambe ku nga si hela . Ku engetela kwalaho, ku vitaniwa ka ndlela eka xiphemu lexi cincaka ku ta honisiwa .
Vona matsalwa ya hina ya JavaScript ku kuma vuxokoxoko byo tala .
Ndlela | Nhlamuselo |
---|---|
disable |
Ku susa vuswikoti bya xitirhisiwa xa elemente ku kombisiwa. Xitsundzuxo xa switirhisiwa xi ta kota ku kombisiwa ntsena loko xi pfuriwile nakambe. |
dispose |
Ku tumbeta no herisa xitirhisiwa xa elemente (Ku susa data leyi hlayisiweke eka elemente ya DOM). Switirhisiwa leswi tirhisaka ku rhumeriwa (leswi endliwaka hi ku tirhisa selector nhlawulo ) a swi nge herisiwi hi swoxe eka swiaki swa xihlohloteri swa vatukulu. |
enable |
Yi nyika xitirhisiwa xa elemente vuswikoti byo kombisiwa. Switsundzuxo swa switirhisiwa swi tirhisiwa hi ku tiyimisela. |
getInstance |
Ndlela ya static leyi ku pfumelelaka ku kuma xikombiso xa tooltip lexi fambelanaka na elemente ya DOM, kumbe ku tumbuluxa leyintshwa loko ko tshuka ku nga sunguriwanga. |
getOrCreateInstance |
Ndlela ya static leyi ku pfumelelaka ku kuma xikombiso xa tooltip lexi fambelanaka na elemente ya DOM, kumbe ku tumbuluxa leyintshwa loko ko tshuka ku nga sunguriwanga. |
hide |
Ku fihla xitsundzuxo xa xitirhisiwa xa elemente. Ku tlhelela eka mufoyini xitsundzuxo xa xitirhisiwa xi nga si fihliwa hakunene (i.e. hidden.bs.tooltip xiendlakalo xi nga si humelela). Leswi swi tekiwa tanihi ku pfuxa “manual” ka xitsundzuxo xa xitirhisiwa. |
setContent |
Yi nyika ndlela yo cinca nhundzu ya xitirhisiwa endzhaku ka ku sunguriwa ka yona. |
show |
Ku paluxa xitsundzuxo xa xitirhisiwa xa elemente. Ku tlhelela eka mufoyini xitsundzuxo xa xitirhisiwa xi nga si kombisiwa hakunene (i.e. shown.bs.tooltip xiendlakalo xi nga si humelela). Leswi swi tekiwa tanihi ku pfuxa “manual” ka xitsundzuxo xa xitirhisiwa. Switsundzuxo swa switirhisiwa leswi nga ni swihloko swa ku leha ka zero a swi si tshama swi kombisiwa. |
toggle |
Ku cinca-cinca xitsundzuxo xa xitirhisiwa xa elemente. Ku tlhelela eka mufoyini xitsundzuxo xa xitirhisiwa xi nga si kombisiwa hakunene kumbe ku fihliwa (i.e. emahlweni ka ku humelela shown.bs.tooltip kumbe hidden.bs.tooltip xiendlakalo). Leswi swi tekiwa tanihi ku pfuxa “manual” ka xitsundzuxo xa xitirhisiwa. |
toggleEnabled |
Ku cinca vuswikoti bya xitirhisiwa xa elemente ku kombisiwa kumbe ku fihliwa. |
update |
Ku pfuxeta xiyimo xa xitsundzuxo xa xitirhisiwa xa elemente. |
const tooltip = bootstrap.Tooltip.getInstance('#example') // Returns a Bootstrap tooltip instance
// setContent example
tooltip.setContent({ '.tooltip-inner': 'another title' })
setContent
yi amukela
object
argument, laha property-key yin’wana na yin’wana yi nga
string
xihlawulekisi lexi tirhaka endzeni ka popover template, naswona property-value yin’wana na yin’wana leyi fambelanaka yi nga va
string
|
element
|
function
|
null
Swiendlakalo
Nkhuvo | Nhlamuselo |
---|---|
hide.bs.tooltip |
Xiendlakalo lexi xi duvuriwa hi ku hatlisa loko ndlela ya hide xikombiso yi vitaniwile. |
hidden.bs.tooltip |
Xiendlakalo lexi xi duvuriwa loko popover yi hetile ku tumbetiwa eka mutirhisi (yi ta rindza ku cinca ka CSS ku hela). |
inserted.bs.tooltip |
Xiendlakalo lexi xi hlongoriwa endzhaku ka show.bs.tooltip xiendlakalo loko xifaniso xa xitirhisiwa xi engeteriwile eka DOM. |
show.bs.tooltip |
Xiendlakalo lexi xi pfurha hi ku hatlisa loko ku show vitaniwa ndlela ya xikombiso. |
shown.bs.tooltip |
Xiendlakalo lexi xi hlongoriwa loko popover yi endliwile yi vonaka eka mutirhisi (yi ta rindza ku cinca ka CSS ku hela). |
const myTooltipEl = document.getElementById('myTooltip')
const tooltip = bootstrap.Tooltip.getOrCreateInstance(myTooltipEl)
myTooltipEl.addEventListener('hidden.bs.tooltip', () => {
// do something...
})
tooltip.hide()