Kahor intaadan bilaabin qaybta moodeelka Bootstrap, hubi inaad akhrido kuwan soo socda maadaama xulashooyinka liiskayadu ay dhawaan isbeddeleen.
Moodooyinka waxaa lagu dhisay HTML, CSS, iyo JavaScript. Waxay dulsaaran yihiin wax kasta oo kale oo ku jira dukumeentiga oo ka saar rog- <body>rog si ay nuxurka modal u rogo.
Gujinta habka "backdrop" waxay si toos ah u xiri doontaa habka.
Bootstrap waxay taageertaa hal daaqad modal markiiba. Qaababka buulka ah lama taageero maadaama aan aaminsanahay inay yihiin khibrad isticmaale oo liidata.
Isticmaalka moodooyinka position: fixed, kuwaas oo mararka qaarkood noqon kara xoogaa gaar ah oo ku saabsan samayntiisa. Mar kasta oo ay suurtogal tahay, dhig qaabka HTML-kaaga meel heer sare ah si aad uga fogaato faragelinta suurtagalka ah ee ka iman karta walxaha kale. Waxay u badan tahay inaad la kulanto arrimo markaad buul .modalku dhex gelinayso shay kale oo go'an.
Hoos waxaa ku yaal tusaale qaab-dhismeed taagan (macnaheedu waa taas positionoo displaywaa la dhaafay). Waxaa ku jira madaxa modal-ka, modal jirka (loo baahan yahay padding), iyo modal footer (ikhtiyaar ah). Waxaan ku waydiisanaynaa inaad ku darto madax habaysan oo leh ficilo la eryo mar kasta oo ay suurtogal tahay, ama aad bixiso tallaabo kale oo cad oo cayrin ah.
Magaca Modal
Modal qoraalka qoraalka ayaa halkan tagaa.
Muujinta tooska ah
Beddel qaabka shaqada adoo gujinaya badhanka hoose. Hoos ayay u soo degi doontaa oo waxay ka soo geli doontaa xagga sare ee bogga.
Magaca Modal
Woohoo, waxaad qoraalkan u akhrinaysaa qaab habaysan!
Duubista nuxur dheer
Marka moodalku aad ugu dheeraado aragtida isticmaalaha ama aaladda, waxay u rogaan si madaxbannaan bogga laftiisa. Isku day demo hoose si aad u aragto waxa aanu ula jeedno.
Magaca Modal
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Mid toosan
Ku dar .modal-dialog-centeredsi .modal-dialogtoosan u dhexda habka
Modal title
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Tilmaamaha qalabka iyo popovers
Tilmaamaha qalabka iyo popovers waxaa lagu dhejin karaa qaab-dhismeedka hadba sida loo baahdo . Marka hababka la xidho, qalab kasta iyo wax-soo-saarka gudaha sidoo kale si toos ah ayaa loo ruqseeyaa.
Hayso farabadan badhamada kuwaas oo dhamaantood kicinaya qaab isku mid ah oo ka kooban waxyar oo kala duwan? Isticmaal event.relatedTargetiyo sifooyinka HTMLdata-* (laga yaabo iyada oo loo marayo jQuery ) si loo kala beddelo waxa ku jira habka iyadoo ku xiran badhanka la gujiyay.
Hoos waxaa ah demo toos ah oo ay ku xigto tusaale HTML iyo JavaScript. Wixii macluumaad dheeraad ah, akhri dukumeentiyada dhacdooyinka modal wixii faahfaahin ah relatedTarget.
New message
Beddel animation
Doorsoomuhu wuxuu $modal-fade-transformgo'aamiyaa xaaladda isbeddelka ka .modal-dialoghor inta aan modal-ku-dhamin animation-ka, $modal-show-transformdoorsoomuhu wuxuu go'aamiyaa isbeddelka .modal-dialogdhammaadka modal-ku-dhalashada animation-ka.
Qaababka si fudud u muuqda halkii ay ka libdhi lahaayeen si loo eego, ka saar .fadefasalka calaamadaynta qaabkaaga.
Dhererka firfircoon
Haddii dhererka modalku is beddelo marka uu furan yahay, waa inaad wacdaa $('#myModal').modal('handleUpdate')si aad u hagaajiso booska modalka haddii ay dhacdo in bir-rogid u muuqato.
Helitaanka
Hubi inaad ku darto role="dialog"iyo aria-labelledby="...", tixraaca cinwaanka modal , to , .modaliyo laftiisa. Intaa waxaa dheer, waxaad ku siin kartaa sharaxaad ku saabsan wada-hadalka qaab-dhismeedkaaga ee ku yaal .role="document".modal-dialogaria-describedby.modal
Ku darida fiidiyowyada YouTube
Ku darida fiidyaha YouTube ee moodooyinka waxay u baahan tahay JavaScript dheeri ah oo aan ku jirin Bootstrap si ay si toos ah u joojiso dib u ciyaarida iyo wax ka badan. Fiiri qoraalkan waxtarka leh ee Stack Overflow wixii macluumaad dheeraad ah.
Cabbirrada ikhtiyaariga ah
Moodooyinka waxay leeyihiin saddex cabbir ikhtiyaari ah, oo lagu heli karo fasallada wax ka beddelka si loogu dhejiyo .modal-dialog. Xajmiyadani waxay ka soo galayaan meelo kala goyn gaar ah si ay uga fogaadaan biibitaannada toosan ee meelaha dhuuban ee daawashada.
Cabbirka
Fasalka
Moodal ballaca ugu badan
Yar
.modal-sm
300px
Asal ahaan
Midna
500px
Weyn
.modal-lg
800px
Aad u weyn
.modal-xl
1140px
Qaabkayaga caadiga ah ee aan lahayn fasalka wax ka beddelka ayaa ka kooban cabbirka cabbirka "dhexdhexaad ah".
Extra large modal
...
Large modal
...
Small modal
...
Isticmaalka
Plugin-ka moodeelku wuxuu beddelaa macluumaadkaaga qarsoon ee baahida, iyada oo loo marayo sifooyinka xogta ama JavaScript. Waxa kale oo ay ku darsataa .modal-openin ay meesha <body>ka saarto hab-dhaqanka duubista caadiga ah waxayna soo saartaa a .modal-backdropsi ay u bixiso aag gujis ah oo lagu eryo moodooyinka la soo bandhigay marka la gujinayo meel ka baxsan habka.
Iyada oo loo marayo sifooyinka xogta
Dhaqdhaqaaqa modal adigoon qorin JavaScript. Deji curiyaha data-toggle="modal"kontoroolka, sida badhan, oo ay la socoto a data-target="#foo"ama href="#foo"si aad u beegsato hab gaar ah si aad u leexiso.
Iyadoo loo marayo JavaScript
Wac modal leh id myModalleh hal xariiq oo JavaScript ah:
Ikhtiyaarada
Ikhtiyaarada waxaa lagu gudbi karaa sifada xogta ama JavaScript. Sifooyinka xogta, ku dheji magaca ikhtiyaarka data-, sida ku jira data-backdrop="".
Magaca
Nooca
Asal ahaan
Sharaxaada
dib-u-dhac
boolean ama xadhig'static'
run
Waxaa ka mid ah curiyaha qaab-dhabeedka. Beddelkeeda, sheeg staticmeel-dambe oo aan xidhin habka gujiska.
kiiboodhka
booliyan
run
Wuxuu xidhaa habka marka furaha baxsadka la riixo
diiradda
booliyan
run
Diirada saara habka marka la bilaabayo.
show
booliyan
run
Muujinaya habka marka la bilaabay.
Hababka
Hababka iyo kala-guurka aan isku midka ahayn
Dhammaan hababka API waa isku mid waxayna bilaabaan kala-guurka . Waxay ku soo noqdaan qofka soo wacaya isla marka uu bilaabmo kala-guurka laakiin ka hor inta uusan dhammaan . Intaa waxaa dheer, hab ku baaqaya in qayb ka beddelka waa la iska indhatiray .
Gacanta ayaa u roga modal Ku soo noqda qofka soo wacay ka hor inta aan habka dhabta ah la muujin ama la qarin (tusaale ka hor inta aanay dhacdada shown.bs.modalama hidden.bs.modaldhacdada dhicin).
.modal('show')
Gacanta ayaa u fura modal Ku soo noqoshada soo wacaha ka hor inta aan habka dhabta ah loo muujin (tusaale ka hor inta aysan shown.bs.modaldhacdada dhicin).
.modal('hide')
Gacanta ayaa u qarisa habka. Ku soo noqoshada soo wacaha ka hor inta aan habka dhabta ah la qarin (ie ka hor intaanay hidden.bs.modaldhacdada dhicin).
.modal('handleUpdate')
Gacanta ku hagaaji booska modalka haddii dhererka qaabku is beddelo marka uu furan yahay (tusaale haddii ay dhacdo in baal-rogid uu soo baxo).
.modal('dispose')
Wuxuu baabi'iyaa habka curiyaha.
Dhacdooyinka
Bootstrap’s modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the <div class="modal">).
Event Type
Description
show.bs.modal
This event fires immediately when the show instance method is called. If caused by a click, the clicked element is available as the relatedTarget property of the event.
shown.bs.modal
This event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). If caused by a click, the clicked element is available as the relatedTarget property of the event.
hide.bs.modal
This event is fired immediately when the hide instance method has been called.
hidden.bs.modal
Dhacdadan waxa la eryaa marka modalku dhammeeyo in laga qariyo isticmaalaha (waxay sugi doontaa inta uu CSS ka gudbayo dhamaystirka).