Bootstrap-a JavaScript modal plugin hmangin i site-ah dialog dah la, lightbox, user notification emaw, custom content kimchang emaw a awm thei ang.
A hnathawh dan
Bootstrap-a modal component i hman tan hmain a hnuaia mi hi chhiar hmasa phawt ang che, tun hnaia kan menu option te a danglam tawh avangin.
Modal te hi HTML, CSS, leh JavaScript hmanga siam a ni. Document chhunga thil dang zawng zawng chungah an dah a, scroll atang chuan an paih chhuak a, <body>chutiang chuan modal content chu a scroll zawk ang.
Modal “backdrop” click chuan modal chu a khar nghal vek ang.
Bootstrap hian modal window pakhat chauh a support a. Nested modal te hi user experience tha lo tak an nih kan rin avangin an support lo.
Modals use position: fixed, chu chu a rendering chungchangah hian a chang chuan a particular deuh thei. A theih phawt chuan element dangte’n an tihbuai theih loh nan i modal HTML chu top-level position-ah dah la. .modalFixed element dang chhunga a nest hunah issue i tawk mai thei .
Vawi khat chu, due to position: fixed, mobile device-a modal hman chungchangah caveat thenkhat a awm bawk. A chipchiar zawkna chu kan browser support docs ah hian en rawh .
HTML5 hian a semantics a sawifiah dan avang hian HTML autofocusattribute hian Bootstrap modal-ah nghawng a nei lo. Chutiang bawka effect nei tur chuan custom JavaScript thenkhat hmang la:
Demo leh hman dan tur kaihhruaina chhiar chhunzawm zel ang che.
Entirna te
Modal component hrang hrang te
A hnuaia tarlan te hi static modal entirnan (a awmzia chu its positionand displayhave been overridden tihna a ni). A chhungah hian modal header, modal body (a mamawh tur padding), leh modal footer (optional) te pawh a tel. A theih phawt chuan dismiss action nen modal header te dah tel turin kan ngen a, a nih loh leh dismiss action chiang tak dang pe turin kan ngen bawk.
Modal title a ni
Modal body text chu hetah hian a kal a.
Live demo a ni ang
A hnuaia button hi click la, working modal demo chu toggle rawh. A hnuai lam a pan ang a, page chunglam atang chuan a fade in ang.
Modal title
Woohoo, you're reading this text in a modal!
Static backdrop a ni
Backdrop chu static-a dah a nih chuan modal chu a pawn lama click-naah a khar dawn lo. A hnuaia button hi click la, enchhin rawh.
Modal title
I will not close if you click outside me. Don't even try to press escape key.
Content thui tak tak scroll
Modal te chu user viewport emaw device emaw atan a sei lutuk chuan page ngei atanga innghat lovin an scroll thin. Kan sawi tum chu a hnuaia demo hi han en teh.
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.
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.
Scrollable modal pawh i siam thei a, chu chuan modal body chu scroll theihna a siam a, chu .modal-dialog-scrollablechu .modal-dialog.
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.
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.
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.
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.
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.
Tooltips leh popovers te pawh a awm bawk
Tooltip leh popover te chu a tul angin modal chhungah dah theih a ni. Modal khar a nih chuan a chhunga tooltip leh popover awm apiang chu automatic in a dismis vek bawk.
Bootstrap grid system chu modal chhungah hmang la .container-fluid, .modal-body. Tichuan, hmun dangah i tih ang bawkin grid system class pangngai te chu hmang ang che.
Grids in modals
.col-md-4
.col-md-4 .ml-auto
.col-md-3 .ml-auto
.col-md-2 .ml-auto
.col-md-6 .ml-auto
Level 1: .col-sm-9
Level 2: .col-8 .col-sm-6
Level 2: .col-4 .col-sm-6
Modal content hrang hrang
Button bunch khat, modal khata trigger vek, content hrang hrang tlem nei? Use event.relatedTargetleh HTML data-*attributes ( jQuery kaltlangin pawh ni thei ) hmangin modal chhunga thu awmte chu eng button nge click tih a zirin a danglam thei.
A hnuaiah hian live demo a awm a, chu chu entirnan HTML leh JavaScript a ni. Hriat belh duh chuan modal events docs chhiar la , relatedTarget.
New message
Animation thlak danglam rawh
Variable hian modal fade-in animation hmaa $modal-fade-transformtransform state a tichiang a, variable chuan modal fade-in animation tawp lamah transform of a ruat bawk..modal-dialog$modal-show-transform.modal-dialog
Entirnan zoom-in animation i duh chuan $modal-fade-transform: scale(.8).
Animation chu paih chhuak rawh
En tur fade in ai chuan modal lang mai mai tur tan chuan .fadei modal markup atang khan class chu paih chhuak rawh.
Dynamic sang tak tak a awm
Modal hawn laiin a san zawng a inthlak $('#myModal').modal('handleUpdate')chuan scrollbar a rawn lang palh hlauh chuan modal awmna tur siamthat leh turin i call tur a ni.
A thlen theihna tur
aria-labelledby="...", modal title reference-in, -ah hian add ngei ang che .modal. Tin, i modal dialog chungchang sawifiahna chu aria-describedbyon hmangin i pe thei .modalbawk. role="dialog"JavaScript hmanga kan add tawh avangin add a ngai lo tih hre reng ang che .
YouTube video te embedding a ni
YouTube video modal-a embede tur chuan Bootstrap-a awm lo JavaScript dang a ngai a, chu chuan playback chu automatic-in a titawp thei a, thil dang tam tak a titawp thei bawk. Hrechiang duh tan he Stack Overflow post \angkai tak hi en la .
A duh duh size te pawh a awm bawk
Modal hian optional size pathum a nei a, modifier class kaltlangin a .modal-dialog. Heng size te hi breakpoint thenkhatah an kick in thin a, chu chuan viewport tawi zawka horizontal scrollbar awm loh nan.
Lenzawng tehna
Pawl
Modal max-a zau zawng a ni
Te
.modal-sm
300px
Hlawhchhamna
Pakhatmah
500px
Hrawl
.modal-lg
800px
Extra lian tak a ni
.modal-xl
1140px
Kan default modal awm lo modifier class hian “medium” size modal a siam a.
Extra large modal
...
Large modal
...
Small modal
...
Hman dan tur
Modal plugin hian i thup thup chu a mamawh angin a toggle a, data attribute emaw JavaScript hmangin a toggle thei bawk. .modal-openTin , <body>to override default scrolling behavior ah a dah belh bawk a .modal-backdrop, modal pawn lama click hunah shown modals dismiss theihna tur click area a siam bawk.
Data attribute hmangin a ni
JavaScript ziak lovin modal pakhat activate rawh. data-toggle="modal"Controller element, button ang chi, a data-target="#foo"or href="#foo"toggle tur modal bik target tur nen set rawh .
JavaScript hmangin
myModalJavaScript line khata id nei modal chu ko rawh :
Thil thlan theih a ni
Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-backdrop="".
Hming
Lampang
Hlawhchhamna
Hrilhfiahna
backdrop a ni
boolean emaw a string emaw a ni'static'
dik
Modal-backdrop element a awm bawk. staticA nih loh leh, click-a modal khar lo backdrop atan specify bawk ang che.
keyboard hmangin a ziak a
boolean a ni
dik
Escape key i hmet chuan modal a khar thin
tumbik nei
boolean a ni
dik
Initialized hunah modal ah focus a dah thin.
lantir
boolean a ni
dik
Initialized hunah modal a lantir.
Thiltih dan tur
Asynchronous method leh inthlak danglamna te
API method zawng zawng hi asynchronous a ni a , transition a tan vek a ni . Transition an tan veleh mahse a tawp hmain call tu hnenah an kir leh thin . Chu bakah, transitioning component-a method call chu ngaihthah a ni ang .
I content chu modal angin a activate thin. A pawm a, optional options a awm objectbawk .
.modal('toggle')
Modal pakhat chu manual in a toggle thin. Modal a lan tak tak hma emaw a thup hma emaw (chu chu shown.bs.modalor hidden.bs.modalevent a thlen hma) caller hnenah a kir leh thin.
.modal('show')
Manual takin modal a hawng thin. Modal a lan tak takshown.bs.modal hmain (chu chu event a thlen hmain ) caller hnenah a kir leh thin.
.modal('hide')
Manual takin modal a thup thin. Modal a thup tak tak hmain (chu chu hidden.bs.modalevent a thlen hma) caller hnenah a kir leh thin.
.modal('handleUpdate')
Modal hawn laiin a san zawng a inthlak chuan (chu chu scrollbar a rawn lang a nih chuan) modal awmna tur chu manual-in siam \ha leh rawh.
.modal('dispose')
Element pakhat modal a tichhia.
Thil thlengte
Bootstrap-a modal class hian modal functionality-a hooking-na tur event tlemte a pholang a ni. Modal event zawng zawng hi modal ngeiah (ie at the <div class="modal">).
Thil thleng chi hrang hrang
Hrilhfiahna
show.bs.modal a ni
showHe event hi instance method kan koh chuan a fire nghal vek a ni. Click avanga lo awm a nih chuan click element chu relatedTargetevent property atan a awm thei.
tih a ni.bs.modal
He event hi modal chu user hmuh theiha siam a nih hunah fire a ni (CSS transition zawh hun a nghak ang). Click avanga lo awm a nih chuan click element chu relatedTargetevent property atan a awm thei.
thup.bs.modal a ni
hideHe event hi instance method koh a nih chuan a fire nghal a ni.
thup.bs.modal tih a ni
He event hi modal chu user hnen atanga thup a nih zawh chuan a fire thin (CSS transitions zawh hun a nghak ang).
thup theih loh.bs.modal
He event hi modal a lan hian a fire a, a backdrop a nih staticchuan modal pawn lama click emaw escape key press emaw hmangin keyboard option emaw data-keyboardset falseto