Popovers
Zolemba ndi zitsanzo zowonjezerera ma popover a Bootstrap, monga omwe amapezeka mu iOS, pazinthu zilizonse patsamba lanu.
Zomwe muyenera kudziwa mukamagwiritsa ntchito pulogalamu ya popover:
- Popovers amadalira laibulale ya chipani chachitatu Popper.js kuti akhazikike. Muyenera kuphatikiza popper.min.js pamaso pa bootstrap.js kapena gwiritsani ntchito
bootstrap.bundle.min.js
/bootstrap.bundle.js
yomwe ili ndi Popper.js kuti ma popover agwire ntchito! - Popovers amafuna chida chowonjezera ngati chodalira.
- Ngati mukupanga JavaScript yathu kuchokera kugwero, pamafunika
util.js
. - Ma Popover amasankha kulowa pazifukwa zogwirira ntchito, chifukwa chake muyenera kuziyambitsa nokha .
- Ziro-utali
title
ndicontent
zikhalidwe sizidzawonetsa popover. - Nenani
container: 'body'
kuti mupewe kupereka zovuta muzinthu zovuta kwambiri (monga magulu athu olowetsa, magulu a batani, ndi zina). - Kuyambitsa popover pazinthu zobisika sikungagwire ntchito.
- Popovers
.disabled
kapenadisabled
zinthu ziyenera kuyambitsidwa pa chinthu chomangira. - Zikayambidwa kuchokera ku anangula omwe amazungulira mizere ingapo, ma popovers amakhala pakati pa nangula wonsewo. Gwiritsani
white-space: nowrap;
ntchito zanu<a>
kuti mupewe izi. - Popovers ayenera kubisidwa zinthu zawo zofananira zisanachotsedwe mu DOM.
Pitilizani kuwerenga kuti muwone momwe popover amagwirira ntchito ndi zitsanzo zina.
Njira imodzi yokhazikitsira ma popovers onse patsamba ingakhale kuwasankha mwamakhalidwe awo data-toggle
:
Mukakhala ndi masitaelo pa chinthu cha makolo chomwe chimasokoneza popover, mudzafuna kufotokoza mwambo container
kuti HTML ya popover iwonekere mkati mwa chinthucho.
<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>
Zosankha zinayi zilipo: pamwamba, kumanja, pansi, ndi kumanzere.
Gwiritsani ntchito focus
choyambitsacho kuti muchotse zotulukapo pakadina kotsatira kwa wogwiritsa wa chinthu china kusiyana ndi chinthu chosinthira.
Chizindikiro china chofunikira pakuchotsa-pa-kudina-kotsatira
Kuti mugwiritse ntchito msakatuli woyenera komanso papulatifomu, muyenera kugwiritsa ntchito tag <a>
, osati<button>
tag, komanso muyenera kuphatikizanso mawonekedwe tabindex
.
<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>
Zinthu zomwe zili ndi mawonekedwe disabled
ake sizimalumikizana, kutanthauza kuti ogwiritsa ntchito sangasunthe kapena kuzidina kuti ayambitse popover (kapena chida). Monga njira yogwirira ntchito, mudzafuna kuyambitsa popover kuchokera ku wrapper <div>
kapena <span>
ndikuwongolera zomwe pointer-events
zili olumala.
Pazinthu zoyambitsa popover zolemala, mungakondenso data-trigger="hover"
kuti popover iwoneke ngati malingaliro apompopompo kwa ogwiritsa ntchito anu chifukwa sangayembekezere kudina chinthu cholemala.
<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>
Yambitsani popover kudzera pa JavaScript:
Zosankha zitha kuperekedwa kudzera pa data kapena JavaScript. Pamawonekedwe a data, yonjezerani dzina lachisankho ku data-
, monga mu data-animation=""
.
Dzina | Mtundu | Zosasintha | Kufotokozera |
---|---|---|---|
makanema ojambula | boolean | zoona | Ikani kusintha kwa CSS fade ku popover |
chotengera | chingwe | chinthu | zabodza | zabodza | Imawonjezera popover ku chinthu china. Chitsanzo: |
zomwe zili | chingwe | chinthu | ntchito | '' | Chitsimikizo cha zinthu ngati Ngati ntchito yaperekedwa, |
kuchedwa | nambala | chinthu | 0 | Kuchedwa kusonyeza ndi kubisa popover (ms) - sikugwira ntchito pamanja choyambitsa mtundu Ngati nambala yaperekedwa, kuchedwetsa kumayikidwa pazithunzi zonse ziwiri Kapangidwe kachinthu ndi: |
html | boolean | zabodza | Ikani HTML mu popover. Ngati zabodza, text njira ya jQuery idzagwiritsidwa ntchito kuyika zomwe zili mu DOM. Gwiritsani ntchito mawu ngati mukuda nkhawa ndi kuukira kwa XSS. |
kuika | chingwe | ntchito | 'chabwino' | Momwe mungayikitsire popover - auto | pamwamba | pansi | kumanzere | kulondola. Ntchito ikagwiritsidwa ntchito kudziwa malo, imatchedwa ndi popover DOM node ngati mkangano wake woyamba komanso chinthu choyambitsa DOM node ngati yachiwiri. Nkhaniyi |
wosankha | chingwe | zabodza | zabodza | Ngati chosankha chaperekedwa, zinthu za popover zidzaperekedwa ku zomwe zafotokozedwazo. M'malo mwake, izi zimagwiritsidwa ntchito kuti zithandizire HTML zomwe zili ndi ma popover awonjezedwe. Onani izi ndi chitsanzo chodziwitsa . |
template | chingwe | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Base HTML kuti mugwiritse ntchito popanga popover. Ma popover adzabayidwa Ma popover adzabayidwa
Chokulunga chakunja chiyenera kukhala ndi |
mutu | chingwe | chinthu | ntchito | '' | Mtengo wamutu wotsikirapo ngati Ngati ntchito yaperekedwa, |
choyambitsa | chingwe | 'dinani' | Momwe popover imayambira - dinani | kugwa | kuganizira | buku. Mutha kudutsa zoyambitsa zambiri; alekanitse iwo ndi danga. `Buku` silingaphatikizidwe ndi choyambitsa china chilichonse. |
kuchepetsa | nambala | chingwe | 0 | Kuchepetsa kwa popover mogwirizana ndi cholinga chake. Kuti mumve zambiri onani za Popper.js's offset docs . |
fallbackPlacement | chingwe | gulu | 'tembenuzani' | Lolani kutchula malo omwe Popper adzagwiritse ntchito pobwerera. Kuti mumve zambiri onani za Popper.js's behaviour docs |
malire | chingwe | chinthu | 'scrollParent' | Kusefukira malire malire a popover. Imavomereza mfundo za 'viewport' , 'window' , 'scrollParent' , kapena HTMLElement reference (JavaScript yokha). Kuti mudziwe zambiri onani zolemba za preventOverflow za Popper.js . |
Mawonekedwe a data pamapopovers apawokha
Zosankha za popovers pawokha zitha kufotokozedwa mwanjira ina pogwiritsa ntchito mawonekedwe a data, monga tafotokozera pamwambapa.
Asynchronous njira ndi kusintha
Njira zonse za API ndizosasinthika ndipo zimayamba kusintha . Amabwerera kwa woyimbayo atangoyamba kusintha koma asanathe . Kuonjezera apo, kuyitana kwa njira pa gawo losintha kudzanyalanyazidwa .
Imayambitsa ma popover pazosonkhanitsira zinthu.
Imawulula kuchuluka kwa zinthu. Imabwereranso kwa woyimba foniyo isanawonetsedwe (ie zisanachitike shown.bs.popover
). Izi zimaganiziridwa kuti ndi "zamanja" zoyambitsa popover. Ma Popovers omwe mutu wawo ndi zomwe zili zazitali sizimawonetsedwa.
Imabisa kuchuluka kwa zinthu. Imabwereranso kwa woyimba foniyo isanabisike (ie zisanachitike hidden.bs.popover
). Izi zimaganiziridwa kuti ndi "zamanja" zoyambitsa popover.
Imasintha kuphulika kwa chinthu. Imabwereranso kwa woyimba foniyo isanawonetsedwe kapena kubisidwa (ie zisanachitike shown.bs.popover
kapena hidden.bs.popover
chochitikacho). Izi zimaganiziridwa kuti ndi "zamanja" zoyambitsa popover.
Imabisa ndikuwononga kufalikira kwa chinthu. Ma Popovers omwe amagwiritsa ntchito kugawira ena (omwe amapangidwa pogwiritsa ntchito selector
mwayi ) sangawonongedwe paokha pazoyambitsa zoyambitsa.
Zimapereka mwayi wowoneka bwino wa element. Popovers amayatsidwa mwachisawawa.
Imachotsa kuthekera kwa popover ya chinthu kuti iwonetsedwe. Popover imatha kuwonetsedwa ngati iyatsidwanso.
Imasintha kuthekera kwa kufalikira kwa chinthu kuti chiwoneke kapena kubisika.
Imasinthiratu pomwe zinthu zachuluka.
Mtundu wa Chochitika | Kufotokozera |
---|---|
onetsani.bs.popover | Chochitika ichi chimayaka nthawi yomweyo show njira yachitsanzo itayitanidwa. |
zowonetsedwa.bs.popover | Chochitikachi chimachotsedwa pamene popover yawonetsedwa kwa wogwiritsa ntchito (idzadikirira kuti kusintha kwa CSS kumalize). |
bisani.bs.popover | Chochitika ichi chimachotsedwa nthawi yomweyo pamene hide njira yachitsanzo yayitanidwa. |
zobisika.bs.popover | Chochitikachi chimachotsedwa pamene popover yatha kubisidwa kwa wogwiritsa ntchito (idikirira kuti kusintha kwa CSS kumalize). |
anaika.bs.popover | Chochitikachi chimachotsedwa pambuyo pa show.bs.popover chochitikacho pamene template ya popover yawonjezedwa ku DOM. |