Popover
Zvinyorwa uye mienzaniso yekuwedzera Bootstrap popovers, seaya anowanikwa muIOS, kune chero chinhu pane yako saiti.
Overview
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
.text-nowrap
pane yako<a>
kudzivirira maitiro aya. - Mapopover anofanirwa kuvanzwa zvinhu zvawo zvinowirirana zvisati zvabviswa muDOM.
- Popovers inogona kukonzereswa nekuda kwechinhu chiri mukati memumvuri DOM.
Iyo animation mhedzisiro yechikamu ichi zvinoenderana prefers-reduced-motion
nemubvunzo wenhau. Ona chikamu chakaderedzwa chezvinyorwa zvedu zvekusvikika .
Ramba uchiverenga kuti uone mashandiro anoita popover nemimwe mienzaniso.
Muenzaniso: Gonesa popovers kwese kwese
Imwe nzira yekutanga mapopovers pane peji ingave yekuvasarudza nehunhu hwavo data-toggle
:
Muenzaniso: Kushandisa container
sarudzo
Paunenge uine mamwe masitayera pane chinhu chemubereki chinokanganisa popover, iwe unozoda kutsanangura tsika container
kuitira kuti popover's HTML ioneke mukati mechinhu ichocho.
Muenzaniso
Nzira ina
Sarudzo ina dziripo: kumusoro, kurudyi, pasi, uye kuruboshwe zvakaenderana.
Ramba paunodzvanya kunotevera
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.
Zvinhu zvakaremara
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.
Usage
Gonesa mapopovers kuburikidza neJavaScript:
Kugadzira mapopovers kushandira kiibhodhi uye vanobatsira tekinoroji vashandisi
Kuti ubvumire vashandisi vekhibhodi kuti vavhure mapopovers ako, iwe unofanirwa kungoawedzera kune HTML zvinhu zvinogara zvichitariswa nekhibhodi uye zvinopindirana (senge zvinongedzo kana mafomu ekudzora). Kunyangwe zvinopokana zveHTML zvinhu ( <span>
senge s) zvichigona kuitwa kuti zvitarisike nekuwedzera tabindex="0"
hunhu, izvi zvinowedzera zvinogona kutsamwisa uye zvinovhiringa tebhu inomira pazvinhu zvisiri-zvinopindirana zvevashandisi vekhibhodi, uye matekinoroji mazhinji anobatsira parizvino haazivise zviri mupopover mumamiriro ezvinhu aya. . Pamusoro pezvo, usavimbe chete hover
sechinhu chinokonzeresa chepopovers yako, sezvo izvi zvichizoita kuti vasakwanise kukonzeresa vashandisi vekhibhodi.
Nepo iwe uchigona kuisa yakapfuma, yakarongeka HTML mumapopovers html
nesarudzo, isu tinokurudzira zvakasimba kuti udzivise kuwedzera huwandu hwakawandisa hwemukati. Mashandiro anoita popovers parizvino ndeyekuti, kana angoratidzwa, zvirimo zvakasungirirwa kune chinokonzeresa chinhu aria-describedby
nehunhu. Nekuda kweizvozvo, zvese zvemukati zvepopover zvichaziviswa kune vabatsiri tekinoroji vashandisi serukova rwumwe rurefu rusina kukanganiswa.
Pamusoro pezvo, kunyangwe zvichikwanisika kubatanidza zvidzoreso zvinopindirana (senge fomu zvinhu kana zvinongedzo) mune yako popover (nekuwedzera zvinhu izvi kune whiteList
kana anotenderwa hunhu uye ma tag), ziva kuti parizvino iyo popover haigadzirise keyboard yekutarisa kurongeka. Kana mushandisi wekhibhodi akavhura popover, kutarisa kunoramba kuri pachinhu chinokonzeresa, uye sezvo iyo popover kazhinji isinga tevere mutsara muchimiro chegwaro, hapana vimbiso yekuti kuenda kumberi / kudzvanya.TABichafambisa mushandisi wekhibhodi mupopover pachayo. Muchidimbu, kungowedzera anodyidzana zvidzoreso kune popover zvinogona kuita kuti zvigadziriso izvi zvisasvike / kusashandika kune vashandisi vekhibhodi nevashandisi vetekinoroji yekubatsira, kana padiki gadzira iyo isina musoro yekutarisa kurongeka. Muzviitiko izvi, funga kushandisa modal dialog pane.
Options
Sarudzo dzinogona kupfuudzwa kuburikidza nedata hunhu kana JavaScript. Nezve data hunhu, wedzera iyo sarudzo zita ku data-
, semu data-animation=""
.
Ziva kuti nekuda kwezvikonzero zvekuchengetedza iyo sanitize
, sanitizeFn
uye whiteList
sarudzo haigone kupihwa uchishandisa data hunhu.
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 nechero imwe trigger. |
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 . |
sanitize | boolean | chokwadi | Gonesa kana kudzima sanitization. Kana ikashandiswa 'template' , 'content' uye 'title' sarudzo dzichacheneswa. |
whiteList | object | Default value | Chinhu chine hunhu uye ma tag anotenderwa |
sanitizeFn | null | basa | null | Pano iwe unogona kupa yako wega sanitize basa. Izvi zvinogona kubatsira kana ukada kushandisa raibhurari yakatsaurirwa kuita sanitization. |
popperConfig | null | object | null | Kuti uchinje Bootstrap's default Popper.js config, ona Popper.js's configuration. |
Data hunhu hwemunhu popovers
Sarudzo dzemapopovers ega dzinogona kutsanangurwa neimwe nzira kuburikidza nekushandisa data hunhu, sezvatsanangurwa pamusoro.
Nzira
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 .
$().popover(options)
Inotanga popover yekuunganidza zvinhu.
.popover('show')
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 zita uye zvirimo zvese zviri zero-kureba hazvimbotaridzwa.
.popover('hide')
Inovanza kubuda kwechinhu. Inodzokera kune ari kufona popover isati yanyatsovanzwa (kureva hidden.bs.popover
chiitiko chisati chaitika). Izvi zvinoonekwa se "manual" inokonzeresa yehupover.
.popover('toggle')
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.
.popover('dispose')
Inoviga uye inoparadza popover yechinhu. Mapopover anoshandisa kugovera (ayo anogadzirwa pachishandiswa sarudzoselector
) haagone kuparadzwa ega pane zvinokonzeresa zvinhu .
.popover('enable')
Inopa element's popover kugona kuratidzwa. Popovers inogoneswa neiyo default.
.popover('disable')
Inobvisa kugona kwechinhu chinobuda pachena. Iyo popover inongo kwanisa kuratidzwa kana ikabatidzwa zvakare.
.popover('toggleEnabled')
Inosandura kugona kwechinhu chinobuda kuti chiratidze kana kuvanzwa.
.popover('update')
Inovandudza nzvimbo yechinhu chinobuda.
Zviitiko
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. |