Design patterns that serve as basic building blocks.
Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults. 모달은 일시적으로 콘텐츠 보기를 제공하는 창입니다. 보통 선택을 하거나 항목의 편집에 사용됩니다.
모달은 요구에 따라 data 속성이나 자바스크립트를 통해 숨겨진 콘텐츠를 토글 합니다.
The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds .modal-open
to the <body>
to override default scrolling behavior and generates a .modal-backdrop
to provide a click area for dismissing shown modals when clicking outside the modal.
A rendered modal with title, set of actions in the header and content.
Activate a modal without writing JavaScript. Set data-toggle="modal"
on a controller element, like a button, along with a data-target="#foo"
or href="#foo"
to target a specific modal to toggle.
Button trigger type
Link trigger type
Call a modal with id myModal
with a single line of JavaScript:
Be sure not to open a modal while another is still visible. Showing more than one modal at a time requires custom code.
Always try to place a modal’s HTML code in a top-level position in your document to avoid other components affecting the modal’s appearance and/or functionality.
There are some caveats regarding using modals on mobile devices. See our browser support docs for details.
모달이 호출될 때, zoom 효과를 적용합니다. 미 지정시 기본 slide-up 애니메이션 효과가 적용됩니다.
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-history=""
. 옵션은 data 속성이나 자바스크립트로 전해질 수 있다. data 속성은 data-selector=”” 처럼 data- 에 옵션명을 덧붙히면 됩니다.
Name | Type | Default | Description |
---|---|---|---|
show | boolean | true | 모달을 호출하는 역할을 합니다. 기본값이 true 이기 때문에 호출시 설정하지 않아도 됩니다. |
title | string | null | |
url | string | null | true 인 경우 브라우저의 url 에 적용됩니다. true 인데 값이 없는 경우 기본값 # 이 적용됩니다. |
history | boolean | true | window.history 객체에 적용되어 back 버튼을 사용해서 컴포넌트를 닫을 수 있게 해줍니다. 기본값이 true 이므로 설정하지 않기 위해서는는 아래와 같이 2가지 방법이 있습니다.| |
template | string | null | 컴포넌트를 호출한 후에 외부의 파일을 load 해야 할 경우 사용하면 됩니다. |
Via data attributes
Via JavaScript
전달된 타이틀 값은 모달 내부에 data-role="title"
이 적용된 요소에 출력됩니다.
Via data attributes
Via JavaScript
Via data attributes
Via JavaScript
history가 기록되지 않은 모달을 닫을 때는 data-dismiss="modal"
을 사용합니다.
Via data attributes
Via JavaScript
.modal(options)
Activates your content as a modal. Accepts an optional options object
.
.modal('toggle')
Manually toggles a modal. Returns to the caller before the modal has actually been shown or hidden (i.e. before the shown.rc.modal
or hidden.rc.modal
event occurs).
.modal('show')
Manually opens a modal. Returns to the caller before the modal has actually been shown (i.e. before the shown.rc.modal
event occurs).
.modal('hide')
Manually hides a modal. Returns to the caller before the modal has actually been hidden (i.e. before the hidden.rc.modal
event occurs).
kimsQ RC’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.rc.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.rc.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.rc.modal | This event is fired immediately when the hide instance method has been called. |
hidden.rc.modal | This event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete). |
loaded.rc.modal | data-template 값으로 정해진 원격 마크업이 load 된 후 실행되는 이벤트 |
show.rc.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.rc.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.
Due to how HTML5 defines its semantics, the autofocus
HTML attribute has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript:
hide.rc.modal
This event is fired immediately when the hide instance method has been called.
hidden.rc.modal
This event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).
loaded.rc.modal
data-template 값으로 정해진 원격 마크업이 load 된 후 실행되는 이벤트
Have a bunch of buttons that all trigger the same modal, just with slightly different contents? Use event.relatedTarget
and HTML data-*
attributes (possibly via jQuery) to vary the contents of the modal depending on which button was clicked. See the Modal Events docs for details on relatedTarget
. 거의 같은 모달을 작동시키는 몇개의 버튼을 가지고 싶으세요? 버튼이 터치 됨에 따라 달라지는 내용을 위해서 event.relatedTarget
와 HTML data-*
속성을 사용하세요. relatedTarget
에 자세한 것은 팝업 이벤트 문서를 보세요