Popovers
Cov ntaub ntawv thiab cov piv txwv rau ntxiv Bootstrap popovers, zoo li cov uas pom hauv iOS no, rau ib qho ntawm koj qhov chaw.
Tej yam uas yuav tsum paub thaum siv lub popover plugin:
- Popovers cia siab rau 3rd tog tsev qiv ntawv Popper.js rau qhov chaw. Koj yuav tsum suav nrog popper.min.js ua ntej bootstrap.js lossis siv
bootstrap.bundle.min.js
/bootstrap.bundle.js
uas muaj Popper.js txhawm rau kom popovers ua haujlwm! - Popovers xav tau lub tooltip plugin raws li kev vam khom.
- Yog tias koj tab tom tsim peb JavaScript los ntawm qhov chaw, nws xav tau
util.js
. - Popovers yog opt-in rau kev ua tau zoo vim li cas, yog li koj yuav tsum pib lawv tus kheej .
- Zero-ntev
title
thiabcontent
qhov tseem ceeb yuav tsis pom qhov popover. - Qhia
container: 'body'
kom tsis txhob muaj teeb meem nyob rau hauv cov khoom siv ntau dua (xws li peb cov tswv yim pab pawg, pawg khawm, thiab lwm yam). - Triggering popovers ntawm cov ntsiab lus zais yuav tsis ua haujlwm.
- Popovers rau
.disabled
los yogdisabled
cov ntsiab lus yuav tsum tau ua rau ntawm cov khoom siv wrapper. - Thaum tshwm sim los ntawm cov thauj tog rau nkoj uas qhwv hla ntau kab, popovers yuav nyob nruab nrab ntawm cov thauj tog rau nkoj 'tag nrho dav. Siv
.text-nowrap
koj<a>
tus kheej kom tsis txhob muaj tus cwj pwm no. - Popovers yuav tsum tau muab zais ua ntej lawv cov ntsiab lus sib raug tau raug tshem tawm ntawm DOM.
Khaws nyeem kom pom tias popovers ua haujlwm li cas nrog qee qhov piv txwv.
Ib txoj hauv kev los pib tag nrho cov popovers ntawm nplooj ntawv yuav yog xaiv lawv los ntawm lawv data-toggle
tus cwj pwm:
Thaum koj muaj qee tus qauv ntawm niam txiv lub caij uas cuam tshuam nrog lub popover, koj yuav xav qhia qhov kev cai container
kom cov popover's HTML tshwm nyob rau hauv cov khoom ntawd.
Plaub txoj kev xaiv muaj: sab saum toj, sab xis, hauv qab, thiab sab laug dlhos.
Siv qhov focus
ua kom tshem tawm cov popovers ntawm tus neeg siv tom ntej nyem ntawm ib lub caij sib txawv dua li qhov hloov pauv.
Cov cim tshwj xeeb xav tau rau kev tshem tawm-ntawm-tom ntej-nias
Txhawm rau kom tus neeg siv khoom sib txawv thiab tus cwj pwm hla lub platform, koj yuav tsum siv lub <a>
cim npe, tsis yog lub <button>
cim, thiab koj kuj yuav tsum muaj tus tabindex
cwj pwm.
Cov ntsiab lus nrog tus disabled
cwj pwm tsis sib cuam tshuam, txhais tau tias cov neeg siv tsis tuaj yeem txav los yog nyem rau lawv kom ua rau popover (lossis cov lus qhia). Raws li kev daws teeb meem, koj yuav xav ua kom lub popover los ntawm lub wrapper <div>
lossis <span>
thiab override rau pointer-events
ntawm lub caij tsis taus.
Rau cov neeg xiam oob qhab popover tshwm sim, koj kuj tseem xav tau data-trigger="hover"
kom cov popover tshwm sim tam sim pom kev tawm tswv yim rau koj cov neeg siv vim lawv yuav tsis xav tias yuav nyem rau ntawm qhov chaw xiam oob qhab.
Qhib popovers ntawm JavaScript:
Cov kev xaiv tuaj yeem dhau los ntawm cov ntaub ntawv tus cwj pwm lossis JavaScript. Rau cov ntaub ntawv tus cwj pwm, ntxiv rau qhov kev xaiv npe rau data-
, xws li hauv data-animation=""
.
Lub npe | Hom | Default | Kev piav qhia |
---|---|---|---|
animation | boolean | muaj tseeb | Siv CSS ploj mus rau qhov popover |
thawv | hlua | element | cuav | cuav | Appends lub popover rau ib lub caij tshwj xeeb. |
cov ntsiab lus | hlua | element | muaj nuj nqi | '' | Default ntsiab lus tus nqi yog Yog tias muaj nuj nqi tau muab, nws yuav raug hu nrog nws cov |
ncua | tus lej | khoom | 0 | ncua kev qhia thiab zais qhov popover (ms) - tsis siv rau phau ntawv txhais hom Yog tias muaj tus lej nkag, ncua sijhawm yog siv rau ob qho tib si zais / qhia Object structure yog: |
html | boolean | cuav | Ntxig HTML rau hauv popover. Yog tias tsis tseeb, jQuery txoj text kev yuav raug siv los ntxig cov ntsiab lus rau hauv DOM. Siv cov ntawv nyeem yog tias koj txhawj xeeb txog XSS tawm tsam. |
tso chaw | hlua | muaj nuj nqi | 'txoj cai' | Yuav ua li cas tso lub popover - pib | saum | hauv qab | sab laug | txoj cai. Thaum muaj nuj nqi yog siv los txiav txim qhov kev tso kawm, nws raug hu nrog popover DOM node raws li nws thawj qhov kev sib cav thiab lub triggering ntsiab DOM node raws li nws thib ob. Cov |
xaiv | hlua | cuav | cuav | Yog tias muaj ib tus neeg xaiv tau muab, cov khoom popover yuav raug xa mus rau cov phiaj xwm tshwj xeeb. Hauv kev xyaum, qhov no yog siv los ua kom cov ntsiab lus HTML dynamic kom muaj popovers ntxiv. Saib qhov no thiab ib qho piv txwv qhia . |
tus qauv | txoj hlua | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Base HTML siv thaum tsim cov popover. Popover's Popover's
Cov txheej txheem wrapper sab nraud yuav tsum muaj |
lub npe | hlua | element | muaj nuj nqi | '' | Default title value yog Yog tias muaj nuj nqi tau muab, nws yuav raug hu nrog nws cov |
ua rau | txoj hlua | 'nias' | Yuav ua li cas popover yog triggered - nyem | hover | tsom | phau ntawv. Koj tuaj yeem hla ntau qhov ua rau; cais lawv nrog ib qho chaw. manual tsis tuaj yeem ua ke nrog lwm qhov ua rau. |
offset | tus lej | txoj hlua | 0 | Offset ntawm popover txheeb ze rau nws lub hom phiaj. Yog xav paub ntxiv mus saib Popper.js's offset docs . |
fallbackPlacement | hlua | array | 'rov qab' | Tso cai kom qhia meej tias txoj hauj lwm twg Popper yuav siv rau qhov poob. Yog xav paub ntxiv mus saib Popper.js tus cwj pwm docs |
ciam teb | hlua | keeb | 'scrollParent' | Overflow constraint ciam teb ntawm lub popover. Txais cov txiaj ntsig ntawm 'viewport' , 'window' , 'scrollParent' , lossis HTMLElement siv (JavaScript nkaus xwb). Yog xav paub ntxiv mus saib Popper.js's PreventOverflow docs . |
Cov ntaub ntawv tus cwj pwm rau tus kheej popovers
Kev xaiv rau ib tus neeg popovers tuaj yeem hloov tau los ntawm kev siv cov ntaub ntawv tus cwj pwm, raws li tau piav qhia saum toj no.
Asynchronous txoj kev thiab kev hloov
Txhua txoj kev API yog asynchronous thiab pib hloov pauv . Lawv rov qab mus rau tus neeg hu xov tooj sai li sai tau thaum qhov kev hloov pauv pib tab sis ua ntej nws xaus . Tsis tas li ntawd, ib txoj kev hu rau ib qho kev hloov pauv yuav raug tsis quav ntsej .
Initializes popovers rau ib qho khoom sau.
Qhia ib lub ntsiab lus popover. Rov qab mus rau tus neeg hu ua ntej qhov popover tau tshwm sim tiag tiag (piv txwv li ua ntej qhov shown.bs.popover
xwm txheej tshwm sim). Qhov no suav hais tias yog "kev tuav tswj" ua rau lub popover. Popovers uas nws ob lub npe thiab cov ntsiab lus yog xoom-ntev yeej tsis tshwm sim.
Hide ib lub ntsiab lus popover. Rov qab mus rau tus neeg hu ua ntej qhov popover tau muab zais tiag tiag (piv txwv li ua ntej qhov hidden.bs.popover
xwm txheej tshwm sim). Qhov no suav hais tias yog "kev tuav tswj" ua rau lub popover.
Toggles ib lub ntsiab lus popover. Rov qab mus rau tus neeg hu ua ntej lub popover tau tshwm sim los yog zais (piv txwv li ua ntej qhov shown.bs.popover
kev hidden.bs.popover
tshwm sim tshwm sim). Qhov no suav hais tias yog "kev tuav tswj" ua rau lub popover.
Nias thiab rhuav tshem lub ntsiab lus popover. Popovers uas siv delegation (uas yog tsim los ntawm selector
kev xaiv ) tsis tuaj yeem raug rhuav tshem ib tus zuj zus ntawm cov xeeb leej xeeb ntxwv.
Muab ib qho chaw popover lub peev xwm los qhia. Popovers tau qhib los ntawm lub neej ntawd.
Tshem tawm lub peev xwm rau lub ntsiab lus popover kom pom. Lub popover tsuas tuaj yeem pom yog tias nws rov qhib dua.
Toggles lub peev xwm rau lub ntsiab lub popover kom pom los yog zais.
Hloov tshiab txoj hauj lwm ntawm lub ntsiab lub popover.
Hom xwm txheej | Kev piav qhia |
---|---|
show.bs.popover | Qhov xwm txheej no tua hluav taws tam sim ntawd thaum show hu ua piv txwv. |
pom.bs.popover | Qhov kev tshwm sim no raug rho tawm haujlwm thaum lub popover tau pom rau tus neeg siv (yuav tos rau CSS kev hloov pauv kom tiav). |
hide.bs.popover | Qhov xwm txheej no raug rho tawm haujlwm tam sim ntawd thaum hide hu ua piv txwv txoj kev. |
zais.bs.popover | Qhov kev tshwm sim no raug rho tawm haujlwm thaum lub popover tiav lawm muab zais los ntawm tus neeg siv (yuav tos rau CSS kev hloov pauv kom tiav). |
inserted.bs.popover | Qhov kev tshwm sim no raug rho tawm haujlwm tom qab qhov show.bs.popover tshwm sim thaum lub popover template tau ntxiv rau DOM. |