Popovers
Takaddun bayanai da misalai don ƙara abubuwan buƙatun Bootstrap, kamar waɗanda aka samu a cikin iOS, zuwa kowane nau'i akan rukunin yanar gizon ku.
Abubuwan da ya kamata ku sani lokacin amfani da plugin ɗin popover:
- Popovers sun dogara da ɗakin karatu na ɓangare na uku Popper.js don matsayi. Dole ne ku haɗa popper.min.js kafin bootstrap.js ko amfani
bootstrap.bundle.min.js
/bootstrap.bundle.js
wanda ya ƙunshi Popper.js domin popovers suyi aiki! - Popovers suna buƙatar plugin ɗin kayan aiki azaman abin dogaro.
- Idan kuna gina JavaScript ɗin mu daga tushe, yana buƙatar
util.js
. - Popovers suna shiga don dalilai na aiki, don haka dole ne ka fara su da kanka .
- Tsawon sifili
title
dacontent
ƙima ba za su taɓa nuna buguwa ba. - Ƙayyade
container: 'body'
don guje wa yin matsaloli a cikin ƙarin hadaddun abubuwa (kamar ƙungiyoyin shigar da mu, ƙungiyoyin maɓalli, da sauransu). - Haɓaka popovers akan abubuwan ɓoye ba zai yi aiki ba.
- Popovers don
.disabled
kodisabled
abubuwan dole ne a kunna su akan abin nadi. - Lokacin da aka kunna shi daga anka waɗanda ke nannade cikin layi ɗaya, popovers za su kasance a tsakiya tsakanin faɗin anka gaba ɗaya. Yi amfani
.text-nowrap
da<a>
s ɗin ku don guje wa wannan halin. - Dole ne a ɓoye maɓuɓɓuka kafin a cire abubuwan da suka dace daga DOM.
Ci gaba da karantawa don ganin yadda popovers ke aiki tare da wasu misalai.
Hanya ɗaya don fara duk popovers akan shafi shine zaɓi su ta hanyar data-toggle
halayensu:
Lokacin da kake da wasu nau'ikan nau'ikan nau'ikan iyaye waɗanda ke tsoma baki tare da popover, za ku so ku saka al'ada container
ta yadda HTML ɗin popover ta bayyana a cikin wannan kashi maimakon.
Akwai zaɓuɓɓuka huɗu: saman, dama, ƙasa, da hagu masu layi.
Yi amfani da focus
faɗakarwa don korar popovers akan danna gaba na mai amfani na wani nau'i na daban fiye da abin juyawa.
Takamaiman alamar da ake buƙata don korar-kan-na gaba-danna
Don dacewa da mai binciken giciye da kuma halayyar dandamali, dole ne ku yi amfani da <a>
alamar, ba alamar ba <button>
, kuma dole ne ku haɗa da tabindex
sifa.
Abubuwan da ke da disabled
sifa ba su da ma'amala, ma'ana masu amfani ba za su iya yin shawagi ko danna su don jawo popover (ko kayan aiki ba). A matsayin madaidaicin aiki, zaku so kunna popover daga abin rufe fuska <div>
ko <span>
kuma ku soke abin da ke pointer-events
kan nakasa.
Don naƙasassun abubuwan faɗowa, kuna iya gwammace data-trigger="hover"
ta yadda popover ɗin ya bayyana azaman ra'ayin gani nan da nan ga masu amfani da ku saboda ƙila ba za su yi tsammanin danna kan wani guragu ba.
Kunna popovers ta JavaScript:
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-animation=""
.
Suna | Nau'in | Default | Bayani |
---|---|---|---|
tashin hankali | boolean | gaskiya | Aiwatar da canjin Fade CSS zuwa popover |
ganga | zaren | kashi | karya | karya | Haɗa popover zuwa takamaiman yanki. Misali |
abun ciki | zaren | kashi | aiki | '' | Tsohuwar ƙimar abun ciki idan Idan an ba da aiki, za a kira shi tare da |
jinkiri | lamba | abu | 0 | Jinkirin nunawa da ɓoye popover (ms) - baya shafi nau'in fararwa na hannu Idan an ba da lamba, ana amfani da jinkiri ga duka ɓoye/nunawa Tsarin abu shine: |
html | boolean | karya | Saka HTML a cikin popover. Idan ƙarya, text za a yi amfani da hanyar jQuery don saka abun ciki a cikin DOM. Yi amfani da rubutu idan kun damu da harin XSS. |
jeri | zaren | aiki | 'dama' | Yadda ake sanya popover - auto | saman | kasa | hagu | dama. Lokacin da aka yi amfani da aiki don ƙayyade wurin, ana kiran shi tare da kumburin DOM popover a matsayin hujjarsa ta farko da maɓallin DOM mai jawowa a matsayin na biyu. An |
mai zaɓe | zaren | karya | karya | Idan an samar da mai zaɓe, za a ba da abubuwan da za a yi amfani da su zuwa ƙayyadaddun manufa. A aikace, ana amfani da wannan don ba da damar abun ciki na HTML mai ƙarfi don ƙara fa'ida. Dubi wannan da misali mai ba da labari . |
samfuri | kirtani | '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' |
Tushen HTML don amfani yayin ƙirƙirar popover. Za a yi allurar popover Za a yi allurar popover
Abun nadi na waje yakamata ya kasance yana da |
take | zaren | kashi | aiki | '' | Tsohuwar ƙimar take idan babu Idan an ba da aiki, za a kira shi tare da |
jawo | kirtani | 'danna' | Yadda ake kunna popover - danna | shawa | mayar da hankali | manual. Kuna iya wuce abubuwan jan hankali da yawa; raba su da sarari. manual ba za a iya haɗa shi da wani abin tayar da hankali ba. |
biya diyya | lamba | kirtani | 0 | Matsalolin popover dangane da manufar sa. Don ƙarin bayani koma zuwa Popper.js's offset docs . |
fallbackPlacement | zaren | tsararru | 'juya' | Bada izinin saka ko wane matsayi Popper zai yi amfani da shi akan koma baya. Don ƙarin bayani koma zuwa Docs halayyar Popper.js |
iyaka | zaren | kashi | ' gungurawaParent' | Matsakaicin ƙaƙƙarfan iyaka na popover. Yana karɓar ƙimar 'viewport' , 'window' , 'scrollParent' , ko ma'anar HTMLElement (JavaScript kawai). Don ƙarin bayani koma zuwa Popper.js's preventoverflow docs . |
Halayen bayanai don faɗuwar mutum ɗaya
Zaɓuɓɓuka don faɗuwar faɗuwar mutum ɗaya ana iya a madadin su ta hanyar amfani da sifofin bayanai, kamar yadda aka bayyana a sama.
Hanyoyi masu daidaitawa da canji
Duk hanyoyin API ba daidai ba ne kuma suna fara canji . Suna komawa ga mai kiran da zarar an fara canji amma kafin ya ƙare . Bugu da ƙari, za a yi watsi da kiran hanya akan ɓangaren canji .
Yana farawa popovers don tarin abubuwa.
Yana bayyana faɗuwar wani abu. Komawa ga mai kira kafin a nuna popover a zahiri (watau kafin shown.bs.popover
abin ya faru). Ana ɗaukar wannan a matsayin "manual" yana haifar da popover. Popovers waɗanda duka take da abun ciki ba tsawon sifili ba ba a taɓa nunawa ba.
Yana ɓoye ɓoyayyen abu. Komawa ga mai kira kafin a ɓoye popover a zahiri (watau kafin hidden.bs.popover
abin ya faru). Ana ɗaukar wannan a matsayin "manual" yana haifar da popover.
Yana jujjuya faɗuwar wani abu. Komawa ga mai kira kafin a nuna ko ɓoye a zahiri (watau kafin abin shown.bs.popover
ko hidden.bs.popover
abin ya faru). Ana ɗaukar wannan a matsayin "manual" yana haifar da popover.
Yana ɓoyewa da lalata faɗuwar wani abu. Popovers da ke amfani da wakilai (waɗanda aka ƙirƙira ta amfani da selector
zaɓi ) ba za a iya lalata su daban-daban akan abubuwan da ke haifar da zuriya ba.
Yana ba da popover na kashi ikon nunawa. Ana kunna Popovers ta tsohuwa.
Yana kawar da damar da za a iya nunawa wani abu na popover. Za a iya nunawa popover kawai idan an sake kunna shi.
Yana jujjuya ikon faɗuwar wani abu don nunawa ko ɓoye.
Yana sabunta matsayin popover na kashi.
Nau'in Taron | Bayani |
---|---|
nuna.bs.popover | Wannan taron yana gobara nan da nan lokacin da show aka kira hanyar misali. |
nuna.bs.popover | Ana korar wannan taron lokacin da aka bayyana popover ga mai amfani (zai jira canjin CSS ya kammala). |
boye.bs.popover | Ana korar wannan taron nan da nan lokacin da hide aka kira hanyar misali. |
boye.bs.popover | Ana korar wannan taron lokacin da popover ya gama ɓoyewa daga mai amfani (zai jira canjin CSS ya kammala). |
shigar.bs.popover | An kori wannan taron bayan show.bs.popover taron lokacin da aka ƙara samfurin popover zuwa DOM. |