Amashanyarazi
Inyandiko n'ingero zo kongera Bootstrap popovers, nkibisangwa muri iOS, kubintu byose kurubuga rwawe.
Incamake
Ibintu ugomba kumenya mugihe ukoresheje plugin ya popover:
- Popovers yisunga isomero ryishyaka rya 3 Popper.js kugirango ihagarare. Ugomba gushyiramo popper.min.js mbere ya bootstrap.js cyangwa gukoresha
bootstrap.bundle.min.js
/bootstrap.bundle.js
irimo Popper.js kugirango popovers ikore! - Popovers isaba ibikoresho bya plugin nkibisabwa .
- Niba wubaka JavaScript yacu kuva isoko, birasaba
util.js
. - Popovers ihitamo kubwimpamvu zikorwa, ugomba rero kubitangiza wenyine .
- Uburebure bwa zeru
title
n'indangagacirocontent
ntibizigera byerekana popover. - Kugaragaza
container: 'body'
kugirango wirinde gutanga ibibazo mubice byinshi bigoye (nkitsinda ryacu ryinjiza, amatsinda ya buto, nibindi). - Gukurura popovers kubintu byihishe ntabwo bizakora.
- Popovers ya
.disabled
cyangwadisabled
ibintu bigomba gukururwa kubintu bipfunyika. - Iyo bivuye ku byuma bifunga imirongo myinshi, popovers izaba hagati yubugari bwa rusange. Koresha
.text-nowrap
kuri<a>
s kugirango wirinde iyi myitwarire. - Popovers igomba guhishwa mbere yuko ibintu bihuye bivanwa muri DOM.
- Popovers irashobora gukururwa bitewe nikintu kiri imbere mu gicucu DOM.
Ingaruka ya animasiyo yibi bice biterwa prefers-reduced-motion
nibibazo byitangazamakuru. Reba igice cyagabanijwe cyicyiciro cyibisobanuro byacu .
Komeza usome kugirango urebe uko popovers ikora hamwe ningero zimwe.
Urugero: Gushoboza popovers ahantu hose
Uburyo bumwe bwo gutangiza popovers zose kurupapuro kwaba ari uguhitamo data-toggle
kubiranga:
Urugero: Ukoresheje container
amahitamo
Mugihe ufite uburyo bumwe kubintu byababyeyi bibangamira popover, uzashaka kwerekana imigenzo container
kugirango HTML ya popover igaragara muri kiriya kintu aho.
Urugero
Ibyerekezo bine
Amahitamo ane arahari: hejuru, iburyo, hepfo, n'ibumoso.
Kwirukana gukanda
Koresha focus
imbarutso kugirango wirukane popovers kumukoresha ukurikiraho ibintu bitandukanye kuruta guhinduranya.
Ikimenyetso cyihariye gisabwa kugirango wirukanwe-gukurikira-gukanda
Kuburyo bukwiye bwambukiranya-mbuga hamwe nimyitwarire ya platform, ugomba gukoresha <a>
tagi, ntabwo ari <button>
tagi, kandi ugomba no gushyiramo tabindex
ikiranga.
Ibintu byahagaritswe
Ibintu bifite disabled
ikiranga ntabwo bikorana, bivuze ko abakoresha badashobora kugendagenda cyangwa kubikanda kugirango batere popover (cyangwa ibikoresho). Nkumurimo, uzakenera gukurura popover uhereye kumuzingo <div>
cyangwa <span>
kurenga pointer-events
kuri element yamugaye.
Kubimuga byahagaritswe byimikorere, urashobora kandi guhitamo data-trigger="hover"
kugirango popover igaragara nkibisubizo byihuse kubakoresha nkuko badashobora gutegereza gukanda kubintu bimugaye.
Ikoreshwa
Gushoboza popovers ukoresheje JavaScript:
Amahitamo
Amahitamo arashobora kunyuzwa kumurongo wamakuru cyangwa JavaScript. Kubiranga Ibyatanzwe, Ongeraho Ihitamo Izina Kuri data-
, Nka Muri data-animation=""
.
Izina | Andika | Mburabuzi | Ibisobanuro |
---|---|---|---|
animasiyo | boolean | ni ukuri | Koresha CSS igenda ihinduka kuri popover |
kontineri | umugozi | ikintu | ibinyoma | ibinyoma | Ongeraho popover kubintu runaka. Urugero : |
ibirimo | umugozi | ikintu | imikorere | '' | Mburabuzi agaciro agaciro niba Niba imikorere yatanzwe, izahamagarwa hamwe |
gutinda | umubare | ikintu | 0 | Gutinda kwerekana no guhisha popover (ms) - ntabwo ikoreshwa muburyo bwintoki Niba umubare watanzwe, gutinda gukoreshwa byombi guhisha / kwerekana Imiterere yibintu ni: |
html | boolean | ibinyoma | Shyiramo HTML muri popover. Niba ari ibinyoma, uburyo bwa jQuery text buzakoreshwa mugushyiramo ibintu muri DOM. Koresha inyandiko niba uhangayikishijwe n'ibitero bya XSS. |
gushyira | umugozi | imikorere | 'iburyo' | Nigute ushobora gushira popover - auto | hejuru | munsi | ibumoso | iburyo. Iyo imikorere ikoreshwa mukumenya aho ishyirwa, byitwa hamwe na popover DOM node nkibitekerezo byayo byambere hamwe na elementing DOM node nkibya kabiri. Imirongo |
uwatoranije | umugozi | ibinyoma | ibinyoma | Niba hatoranijwe uwatoranijwe, ibintu bya popover bizahabwa intego zagenwe. Mu myitozo, ibi bikoreshwa mugushoboza HTML ifite imbaraga kugirango hongerwe popovers. Reba ibi nurugero rwamakuru . |
Inyandikorugero | umugozi | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Shingiro HTML yo gukoresha mugihe uremye popover. Ibya popover Ibya popover
Ikintu cyo gupfunyika hanze kigomba kugira urwego |
Umutwe | umugozi | ikintu | imikorere | '' | Mburabuzi Umutwe Agaciro niba Niba imikorere yatanzwe, izahamagarwa hamwe |
imbarutso | umugozi | 'kanda' | Uburyo popover iterwa - kanda | hover | kwibanda | imfashanyigisho. Urashobora gutsinda imbarutso nyinshi; kubatandukanya n'umwanya. manual ntishobora guhuzwa nizindi mbarutso. |
offset | umubare | umugozi | 0 | Offset ya popover ugereranije nintego yayo. Kubindi bisobanuro reba popper.js ya offset ya doc . |
Gusubira inyuma | umugozi | array | 'flip' | Emera kwerekana umwanya Popper azakoresha mugusubira inyuma. Kubindi bisobanuro reba imyitwarire ya Popper.js |
imbibi | umugozi | element | 'umuzingoParent' | Kurenga imipaka imipaka ya popover. Emera indangagaciro za ,,, 'viewport' cyangwa HTMLElement yerekana (JavaScript gusa). Kubindi bisobanuro reba Popper.js yo gukumiraOverflow docs .'window' 'scrollParent' |
Ibiranga amakuru kuri popovers kugiti cye
Amahitamo ya popovers kugiti cye arashobora gusobanurwa muburyo bwo gukoresha ibiranga amakuru, nkuko byasobanuwe haruguru.
Uburyo
Uburyo butajegajega ninzibacyuho
Inzira zose za API ntizihuza kandi zitangira inzibacyuho . Basubira kumuhamagara mugihe inzibacyuho itangiye ariko itararangira . Mubyongeyeho, uburyo bwo guhamagarira ibice byinzibacyuho bizirengagizwa .
$().popover(options)
Itangiza popovers yikintu cyo gukusanya.
.popover('show')
Yerekana ikintu cya popover. Garuka kumuhamagara mbere yuko popover yerekanwe (nukuvuga mbere yuko shown.bs.popover
ibyabaye biba). Ibi bifatwa nk "intoki" itera popover. Popovers imitwe yombi nibirimo byose ni zeru-ndende ntibigaragara.
.popover('hide')
Hisha ikintu cya popover. Garuka kumuhamagaye mbere yuko popover ihishwa mubyukuri (nukuvuga mbere yuko hidden.bs.popover
ibyabaye biba). Ibi bifatwa nk "intoki" itera popover.
.popover('toggle')
Kuzuza ikintu cya popover. Garuka kumuhamagara mbere yuko popover yerekanwe cyangwa yihishe (nukuvuga mbere yuko ibyabaye shown.bs.popover
cyangwa hidden.bs.popover
ibyabaye bibaho). Ibi bifatwa nk "intoki" itera popover.
.popover('dispose')
Hisha kandi usenye ikintu cya popover. Popovers ikoresha delegasiyo (yashizweho hakoreshejwe amahitamoselector
) ntishobora gusenywa kugiti cye kubintu bikomokaho .
.popover('enable')
Itanga ikintu cya popover ubushobozi bwo kwerekanwa. Popovers ishoboye kubisanzwe.
.popover('disable')
Kuraho ubushobozi bwa element ya popover kugirango yerekanwe. Popover izashobora kwerekanwa gusa niba yongeye gukora.
.popover('toggleEnabled')
Kuzamura ubushobozi bwa popover yibintu kugirango yerekanwe cyangwa ihishe.
.popover('update')
Kuvugurura umwanya wibintu bya popover.
Ibyabaye
Ubwoko bwibyabaye | Ibisobanuro |
---|---|
kwerekana.bs | Ibirori birasa ako kanya mugihe show urugero rwitwa. |
yerekanwe.bs | Ibirori birukanwa mugihe popover yakozwe igaragara kubakoresha (izategereza ko inzibacyuho ya CSS irangira). |
guhisha.bs | Ibi birori birahita bisohoka mugihe uburyo hide bwurugero bwahamagawe. |
bihishe.bs | Ibirori birukanwa mugihe popover yarangije guhishwa uyikoresha (azategereza ko inzibacyuho ya CSS irangira). |
Byinjijwe.bs | Ibirori birukanwe nyuma show.bs.popover yibyabaye mugihe icyitegererezo cya popover cyongewe kuri DOM. |