Amashanyarazi
Inyandiko n'ingero zo kongera Bootstrap popovers, nkibisangwa muri iOS, kubintu byose kurubuga rwawe.
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
white-space: nowrap;
kuri<a>
s kugirango wirinde iyi myitwarire. - Popovers igomba guhishwa mbere yuko ibintu bihuye bivanwa muri DOM.
Komeza usome kugirango urebe uko popovers ikora hamwe ningero zimwe.
Uburyo bumwe bwo gutangiza popovers zose kurupapuro kwaba ari uguhitamo data-toggle
kubiranga:
Mugihe ufite uburyo bumwe kubintu byababyeyi bibangamira popover, uzashaka kwerekana imigenzo container
kugirango HTML ya popover igaragara muri kiriya kintu aho.
<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>
Amahitamo ane arahari: hejuru, iburyo, hepfo, n'ibumoso.
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.
<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>
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.
<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>
Gushoboza popovers ukoresheje JavaScript:
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 butajegajega ninzibacyuho
Inzira zose za API ntizihuza kandi zitangira inzibacyuho . Basubira kumuhamagara mugihe inzibacyuho itangiye ariko itararangira . Mubyongeyeho, uburyo bwo guhamagarira ibice byinzibacyuho bizirengagizwa .
Itangiza popovers yikintu cyo gukusanya.
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.
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.
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.
Hisha kandi usenye ikintu cya popover. Popovers ikoresha delegasiyo (yashizweho hakoreshejwe amahitamoselector
) ntishobora gusenywa kugiti cye kubintu bikomokaho .
Itanga ikintu cya popover ubushobozi bwo kwerekanwa. Popovers ishoboye kubisanzwe.
Kuraho ubushobozi bwa element ya popover kugirango yerekanwe. Popover izashobora kwerekanwa gusa niba yongeye gukora.
Kuzamura ubushobozi bwa popover yibintu kugirango yerekanwe cyangwa ihishe.
Kuvugurura umwanya wibintu bya popover.
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. |