Iipopovers
Amaxwebhu kunye nemizekelo yokongezwa kweBootstrap poppovers, njengaleyo ifumaneka kwi-iOS, kuyo nayiphi na into ekwisiza sakho.
Isishwankathelo
Izinto omawuzazi xa usebenzisa iplagi yepopover:
- Abantu abadumileyo baxhomekeke kwithala leencwadi le-3rd Popper.js ngokubekwa . Kufuneka uquke i -popper.min.js phambi kwe-bootstrap.js okanye usebenzise
bootstrap.bundle.min.js
/bootstrap.bundle.js
equlethe i-Popper.js ukuze i-popovers isebenze! - IiPopovers zifuna iplagi yesixhobo njengesixhobo sokuxhomekeka.
- Ukuba wakha iJavaScript yethu kwimvelaphi, kufuna
util.js
. - IiPopovers zingenile ngenxa yezizathu zokusebenza, ke kufuneka uziqalise ngokwakho .
- Ubude obuziro
title
kunyecontent
namaxabiso asoze abonise ipopover. - Cacisa
container: 'body'
ukunqanda unikezelo lweengxaki kumacandelo antsokothileyo (njengamaqela ethu egalelo, amaqela amaqhosha, njl.njl). - Ukuxhokonxa iipopovers kwizinto ezifihlakeleyo aziyi kusebenza.
- Iipopovers ze
.disabled
okanye ielementi kufuneka zivuswe kwinto esongelwayodisabled
. - Xa isenziwa ukusuka kwii-ankile ezisonga kwimigca emininzi, iipopovers ziya kugxininiswa phakathi kobubanzi beankile ngokubanzi. Sebenzisa
.text-nowrap
kwi yakho<a>
ukunqanda le ukuziphatha. - Iipopovers mazifihlwe phambi kokuba izinto ezihambelanayo zisuswe kwiDOM.
- Iipopovers zinokuvuswa enkosi kwinto engaphakathi kwesithunzi se-DOM.
Isiphumo soopopayi seli candelo sixhomekeke prefers-reduced-motion
kumbuzo wemidiya. Jonga icandelo leentshukumo ezincitshisiweyo kuxwebhu lwethu lofikelelo .
Qhubeka ufunda ukuze ubone indlela iipopovers ezisebenza ngayo neminye imizekelo.
Umzekelo: Vumela iipopovers kuyo yonke indawo
Enye indlela yokuqalisa zonke iipopovers kwiphepha inokuba kukukhetha ngophawu lwazo data-toggle
:
Umzekelo: Ukusebenzisa container
ukhetho
Xa unezinye izimbo kwinto yomzali ephazamisana ne-popover, uya kufuna ukukhankanya isiko container
ukuze i-HTML ye-popover ivele ngaphakathi kweso siqalelo endaweni yoko.
Umzekelo
Iindlela ezine
Zine iinketho ezikhoyo: phezulu, ekunene, ezantsi, nasekhohlo zilungelelanisiwe.
Lahla ngokucofa okulandelayo
Sebenzisa i- focus
trigger ukugxotha iipopovers kunqakrazo olulandelayo lomsebenzisi lwento eyahlukileyo kunento yokuguqula.
Uphawulo oluthile luyafuneka ukuze ugxothe-ngokucofa-okulandelayo
Kwibrowser echanekileyo kunye nokuziphatha kweqonga, kufuneka usebenzise <a>
ithegi, hayi ithegi , <button>
kwaye kufuneka uquke tabindex
uphawu loyelelwano.
Izinto ezikhubazekileyo
Izinto disabled
ezinophawu azisebenzi, oku kuthetha ukuba abasebenzisi abanako ukushukuma okanye ukucofa ukuze baqalise ipopover (okanye inqaku lesixhobo). Njengomsebenzi wokusebenza, uya kufuna ukwenza i-popover kwi-wrapper <div>
okanye <span>
kwaye ubhale ngaphezulu pointer-events
kwinto ekhubazekileyo.
Kwiziphembeleli ze-popover ezikhubazekileyo, unokukhetha kwakhona data-trigger="hover"
ukuze i-popover ibonakale njengengxelo ebonwayo kwangoko kubasebenzisi bakho njengoko bengenakulindela ukucofa into ekhubazekileyo.
Ukusetyenziswa
Vumela iipopovers ngeJavaScript:
Iinketho
Iinketho zinokugqithiswa ngeempawu zedatha okanye iJavaScript. Kuphawu lwedatha, faka igama lokhetho ku data-
, njengakwi data-animation=""
.
Igama | Uhlobo | Ukuhlala kukho | Inkcazo |
---|---|---|---|
oopopayi | boolean | yinyani | Faka inguqu ye-CSS fade kwi-popover |
isikhongozeli | umtya | into | bubuxoki | bubuxoki | Ifakela ipopover kwinto ethile. Umzekelo: |
umxholo | umtya | into | umsebenzi | '' | Ixabiso lomxholo Ukuba umsebenzi unikiwe, uya kubizwa ngokuba |
ukulibazisa | inombolo | into | 0 | Ukulibazisa ukubonisa kunye nokufihla i-popover (ms) - ayisebenzi kuhlobo lwe-trigger ye-manual Ukuba inani linikiwe, ukulibaziseka kufakwa kuzo zombini ezifihla/umboniso Ulwakhiwo lwento yile: |
html | boolean | bubuxoki | Faka i-HTML kwi-popover. Ukuba ayiyonyani, text indlela yejQuery izakusetyenziswa ukufaka umxholo kwiDOM. Sebenzisa umbhalo ukuba unexhala malunga nohlaselo lwe-XSS. |
ukubekwa | umtya | umsebenzi | 'kunene' | Indlela yokubeka ipopover - auto | phezulu | emazantsi | ekhohlo | kunene. Xa umsebenzi usetyenziswa ukumisela indawo, ibizwa ngokuba yi-popover node ye-DOM njengengxoxo yayo yokuqala kunye nesiqalo se-DOM node njengesibini sayo. Umxholo |
umkhethi | umtya | bubuxoki | bubuxoki | Ukuba umkhethi unikiwe, izinto ze popover ziya kunikezelwa kwiithagethi ezichaziweyo. Ngokwesiqhelo, oku kusetyenziselwa ukwenza umxholo weHTML oguquguqukayo ube neepopovers zongezwe. Bona oku kunye nomzekelo ofundisayo . |
ithempleyithi | umtya | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Isiseko se-HTML esinokusetyenziswa xa usenza ipopover. I-popover's I-popover's
Isiqalelo sokusonga sangaphandle kufuneka sibe |
isihloko | umtya | into | umsebenzi | '' | Ixabiso lesihloko esihlala sihleli ukuba Ukuba umsebenzi unikiwe, uya kubizwa ngokuba |
ukuxhokonxa | umtya | 'cofa' | Ivuswa njani ipopover - cofa | jonga | gxila | incwadi yesandla. Unokudlula izichukumisi ezininzi; bahlule ngesithuba. manual ayinakudityaniswa naso nasiphi na esinye isiqhushumbisi. |
i-offset | inombolo | umtya | 0 | I-Offset ye-popover malunga nokujoliswe kuyo. Ngolwazi oluthe kratya jonga kwi-Popper.js's offset docs . |
i-fallbackPlacement | umtya | uluhlu | 'jika' | Vumela ukuxela ukuba yeyiphi indawo iPopper eza kusebenzisa xa ubuya umva. Ngolwazi oluthe vetshe bhekisa kuPopper.js's behaviour docs |
umda | umtya | isiqalelo | 'skrolaMzali' | Ukuphuphuma komda womda wepopover. Yamkela amaxabiso e- 'viewport' , 'window' , 'scrollParent' , okanye i-HTMLElement ireferensi (iJavaScript kuphela). Ngolwazi oluthe vetshe bhekisa kuPopper.js's preventOverflow docs . |
Iimpawu zedatha yepopovers nganye
Ukhetho lwepopovers nganye lunokuchazwa ngokusetyenziswa kweempawu zedatha, njengoko kucacisiwe ngasentla.
Iindlela
Iindlela ze-Asynchronous kunye notshintsho
Zonke iindlela ze-API zi -asynchronous kwaye ziqala utshintsho . Babuyela kumnxeba ngokukhawuleza nje ukuba utshintsho luqalisiwe kodwa ngaphambi kokuba luphele . Ukongeza, ukufowunelwa kwendlela kwicandelo lenguquko kuya kuhoywa .
$().popover(options)
Uqalisa iipopovers zengqokelela yezinto.
.popover('show')
Ityhila ukuvela kwento ethile. Ibuyisela kumnxeba phambi kokuba i-popover iboniswe (okt phambi kokuba shown.bs.popover
isiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover. Iipopovers ezinesihloko kunye nomxholo onguziro-ubude azizange ziboniswe.
.popover('hide')
Ifihla imvelaphi yento. Ibuyisela kumnxeba phambi kokuba i-popover ifihliwe (okt phambi kokuba hidden.bs.popover
isiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover.
.popover('toggle')
Itshintsha ipopover yesiqalelo. Ibuyisela kumnxeba phambi kokuba i-popover iboniswe okanye ifihliwe (okt phambi kokuba isiganeko shown.bs.popover
okanye hidden.bs.popover
isiganeko senzeke). Oku kuthathwa njenge "manual" yokuqalisa i-popover.
.popover('dispose')
Ifihla kwaye itshabalalise i-element's popover. Iipopovers ezisebenzisa unikezelo (okuyilwe kusetyenziswa ukhethoselector
) azinakutshatyalaliswa zizodwa kwinzala yezinto ezibangelayo .
.popover('enable')
Inika i- element's popover isakhono sokuboniswa. Iipopovers zenziwe ngokuzenzekelayo.
.popover('disable')
Isusa isakhono se popover yesiqalelo esizakuboniswa. I-popover iya kuboniswa kuphela ukuba ivuliwe kwakhona.
.popover('toggleEnabled')
Iguqulela isakhono se-popover yesiqalelo esiboniswa okanye sifihlwe.
.popover('update')
Ihlaziya indawo ye popover yento.
Iziganeko
Uhlobo loMnyhadala | Inkcazo |
---|---|
bonisa.bs.popover | Esi siganeko sivutha ngokukhawuleza xa show kubizwa indlela yomzekelo. |
ibonisiwe.bs.popover | Esi siganeko sigxothwa xa i-popover yenziwe yabonakala kumsebenzisi (iya kulinda iinguqu zeCSS ukuba zigqibe). |
fihla.bs.popover | Esi siganeko sigxothwa ngokukhawuleza xa hide indlela yomzekelo ibiziwe. |
efihliweyo.bs.popover | Esi siganeko sigxothwa xa i-popover igqibile ukufihlwa kumsebenzisi (iya kulinda iinguqu zeCSS ukuba zigqibe). |
ifakiwe.bs.popover | Esi siganeko sigxothwa emva show.bs.popover kwesiganeko xa i-template ye-popover yongezwa kwi-DOM. |