Popover
Zvinyorwa uye mienzaniso yekuwedzera Bootstrap popovers, seaya anowanikwa muIOS, kune chero chinhu pane yako saiti.
Zvinhu zvekuziva kana uchishandisa popover plugin:
- Popovers vanovimba neyechitatu bato raibhurari Popper.js yekumisikidza . Unofanira kusanganisira popper.min.js pamberi bootstrap.js kana kushandisa
bootstrap.bundle.min.js
/bootstrap.bundle.js
iyo ine Popper.js kuitira kuti popovers kushanda! - Popovers inoda iyo tooltip plugin sekutsamira .
- Kana iwe uri kuvaka yedu JavaScript kubva kunobva, zvinoda
util.js
. - Mapopovers anosarudza-kupinda nekuda kwezvikonzero zvekuita, saka iwe unofanirwa kuzvitangisa iwe pachako .
- Zero-kureba
title
uyecontent
kukosha hazvizomboratidzi popover. - Nyora
container: 'body'
kudzivirira kupa matambudziko muzvikamu zvakaoma zvikuru (semapoka edu ekuisa, mapoka emabhatani, nezvimwe). - Kukurudzira popover pazvinhu zvakavanzika hazvishande.
- Mapopovers e
.disabled
kana madisabled
element anofanira kukonzereswa pane wrapper element. - Kana ikamutswa kubva kune zvibatiso zvinoputira mumitsetse yakawanda, mapopovers achange ari pakati pehupamhi hwezvimiso. Shandisa
white-space: nowrap;
pane yako<a>
kudzivirira maitiro aya. - Mapopover anofanirwa kuvanzwa zvinhu zvawo zvinowirirana zvisati zvabviswa muDOM.
Ramba uchiverenga kuti uone mashandiro anoita popover nemimwe mienzaniso.
Imwe nzira yekutanga mapopovers pane peji ingave yekuvasarudza nehunhu hwavo data-toggle
:
Paunenge uine mamwe masitayera pane chinhu chemubereki chinokanganisa popover, iwe unozoda kutsanangura tsika container
kuitira kuti popover's HTML ioneke mukati mechinhu ichocho.
<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>
Sarudzo ina dziripo: kumusoro, kurudyi, pasi, uye kuruboshwe zvakaenderana.
Shandisa focus
chibatiso kuti udzinge mapopovers pakudzvanya kunotevera kwemushandisi kwechimwe chinhu pane chekuchinja.
Yakananga markup inodiwa pakubvisa-pa-inotevera-kubaya
Kuti uwane chaiyo-muchinjika-browser uye muchinjika-chikuva maitiro, iwe unofanirwa kushandisa iyo <a>
tag, kwete iyo <button>
tag, uye iwe zvakare unofanirwa kusanganisira tabindex
hunhu.
<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>
Zvinhu zvine disabled
hunhu hazvidyidzane, zvichireva kuti vashandisi havagone kusimudza kana kudzvanya kuti vakonzerese popover (kana tooltip). Sekushanda, iwe unozoda kukonzeresa popover kubva pakuputira <div>
kana <span>
uye nekupfuura iyo pointer-events
pane yakaremara chinhu.
Kune akaremara popover zvinokonzeresa, unogona zvakare kuda data-trigger="hover"
kuitira kuti popover ioneke semhinduro yekuona nekukurumidza kune vashandisi vako sezvo vangasatarisira kudzvanya chinhu chakaremara.
<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>
Gonesa mapopovers kuburikidza neJavaScript:
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-animation=""
.
Zita | Type | Default | Tsanangudzo |
---|---|---|---|
animation | boolean | chokwadi | Isa CSS fade shanduko kune popover |
mudziyo | tambo | chinhu | nhema | nhema | Inoisa popover kune chimwe chinhu. Muenzaniso |
content | tambo | chinhu | basa | '' | Default content value kana Kana basa rakapihwa, rinodaidzwa nereferensi yaro |
delay | nhamba | object | 0 | Kunonoka kuratidza uye kuvanza iyo popover (ms) - haishande kune manual trigger type Kana nhamba yapihwa, kunonoka kunoiswa kune ese ari maviri hide/show Chimiro chechinhu ndeichi: |
html | boolean | nhema | Isa HTML mune popover. Kana nhema, nzira yejQuery text ichashandiswa kuisa zvirimo muDOM. Shandisa zvinyorwa kana uchinetseka nezve XSS kurwiswa. |
kuiswa | tambo | basa | 'rudyi' | Maitiro ekuisa iyo popover - auto | pamusoro | pasi | left | rudyi. Kana basa rikashandiswa kuona kuiswa, rinodaidzwa nepopover DOM node senharo yayo yekutanga uye chinokonzeresa DOM node sechipiri. Mamiriro |
selector | tambo | nhema | nhema | Kana sarudzo yakapihwa, popover zvinhu zvinopihwa kune izvo zvakatarwa. Mukuita, izvi zvinoshandiswa kugonesa dynamic HTML zvemukati kuve nemapopovers akawedzerwa. Ona izvi uye muenzaniso unodzidzisa . |
template | tambo | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Base HTML yekushandisa paunenge uchigadzira popover. Iyo popover's Iyo popover's
Chinhu chekunze chekuputira chinofanira kunge chine |
title | tambo | chinhu | basa | '' | Default title value kana Kana basa rakapihwa, rinodaidzwa nereferensi yaro |
trigger | tambo | 'tinya' | Iyo popover inokonzereswa sei - tinya | hovha | focus | manual. Unogona kupfuura akawanda anokonzeresa; vaparadzanise nenzvimbo. `manual` haigone kusanganiswa nechimwe chinokonzeresa. |
offset | nhamba | tambo | 0 | Offset ye poover inoenderana nechinangwa chayo. Kuti uwane rumwe ruzivo tarisa kuPopper.js's offset docs . |
fallbackPlacement | tambo | array | 'pindurudza' | Bvumira kudoma chinzvimbo chichashandiswa naPopper pakudonha. Kuti uwane rumwe ruzivo tarisa kune Popper.js's maitiro docs |
muganhu | tambo | element | 'scrollParent' | Kufashukira kunomanikidza muganho wepopover. Inobvuma kukosha kwe 'viewport' , 'window' , 'scrollParent' , kana HTMLElement referensi (JavaScript chete). Kuti uwane rumwe ruzivo tarisa kune Popper.js's preventOverflow docs . |
Data hunhu hwemunhu popovers
Sarudzo dzemapopovers ega dzinogona kutsanangurwa neimwe nzira kuburikidza nekushandisa data hunhu, sezvatsanangurwa pamusoro.
Asynchronous nzira uye shanduko
Yese nzira dzeAPI dzine asynchronous uye dzinotanga shanduko . Vanodzokera kumunhu anenge afona pachangotanga shanduko asi isati yapera . Pamusoro pezvo, kufona kwenzira pachikamu chekuchinja kuchafuratirwa .
Inotanga popover yekuunganidza zvinhu.
Inoratidza kubuda kwechimwe chinhu. Inodzokera kumunhu arikufona popover isati yanyatsoratidzwa (kureva kuti shown.bs.popover
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yehupover. Mapopovers ane zvese zita uye zvirimo zviri zero-kureba hazvimbotaridzwa.
Inovanza kubuda kwechinhu. Inodzokera kune ari kufona popover isati yanyatsovanzwa (kureva hidden.bs.popover
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yehupover.
Inoshandura kubuda kwechinhu. Inodzokera kumunhu arikufona popover isati yanyatsoratidzwa kana kuvanzwa (kureva kuti shown.bs.popover
kana hidden.bs.popover
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yehupover.
Inoviga uye inoparadza popover yechinhu. Mapopover anoshandisa kugovera (ayo anogadzirwa pachishandiswa sarudzoselector
) haagone kuparadzwa ega pane zvinokonzeresa zvinhu .
Inopa element's popover kugona kuratidzwa. Popovers inogoneswa neiyo default.
Inobvisa kugona kwechinhu chinobuda pachena. Iyo popover inongo kwanisa kuratidzwa kana ikabatidzwa zvakare.
Inosandura kugona kwechinhu chinobuda kuti chiratidze kana kuvanzwa.
Inovandudza nzvimbo yechinhu chinobuda.
Chiitiko Type | Tsanangudzo |
---|---|
show.bs.popover | Ichi chiitiko chinopisa nekukasira kana show nzira yemuenzaniso inodanwa. |
display.bs.popover | Ichi chiitiko chinodzingwa kana popover yaitwa kuti ionekwe kumushandisi (inomirira kuti CSS shanduko ipedze). |
hide.bs.popover | Ichi chiitiko chinodzingwa nekukasira kana iyo hide muenzaniso nzira yadaidzwa. |
zvakavanzika.bs.popover | Ichi chiitiko chinodzingwa kana popover yapedza kuvanzwa kubva kumushandisi (inomirira kuti CSS shanduko ipedze). |
inserted.bs.popover | Ichi chiitiko chinodzingwa mushure show.bs.popover mechiitiko apo popover template yawedzerwa kuDOM. |