Design patterns that serve as basic building blocks.
Popups are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.
모달은 요구에 따라 data 속성이나 자바스크립트를 통해 숨겨진 콘텐츠를 토글 합니다.
The popup plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds .popup-open
to the <body>
to override default scrolling behavior and generates a .popup-backdrop
to provide a click area for dismissing shown popups when clicking outside the popup.
A rendered popup with title, set of actions in the header and content.
Activate a popup without writing JavaScript. Set data-toggle="popup"
on a controller element, like a button, along with a data-target="#foo"
or href="#foo"
to target a specific popup to toggle.
Button trigger type
Link trigger type
Call a popup with id myPopup
with a single line of JavaScript:
Be sure not to open a popup while another is still visible. Showing more than one popup at a time requires custom code.
Always try to place a popup’s HTML code in a top-level position in your document to avoid other components affecting the popup’s appearance and/or functionality.
There are some caveats regarding using popups on mobile devices. See our browser support docs for details.
팝업이 호출될 때, 에니메이션 효과를 적용합니다. 지정된 값은 팝업 컨테이너에 class 에 적용되며, 미 지정시 애니메이션 효과가 사라집니다.
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 해야 할 경우 사용하면 됩니다. |
backdrop | boolean or the string | true | 배경을 포함합니다. 팝업을 닫지 않는 배경이 필요할 경우 static 를 명시하세요. |
string
null
data-title="값"
으로 값을 전달하고 출력을 원하는 엘리먼트에 data-role="title"
로 받아서 출력합니다.Via data attributes
Via JavaScript
전달된 타이틀 값은 모달 내부에 data-role="title"
이 적용된 요소에 출력됩니다.
string
null
#
(기본값) 이 적용되며 history 옵션이 true
인 경우만 작동됩니다.Via data attributes
Via JavaScript
window.history
객체에 기록되어 스마트폰의 back 버튼을 사용해서 팝업을 닫을 수 있게 해줍니다.boolean
ture
Via data attributes
Via JavaScript
history가 기록되지 않은 모달을 닫을 때는 data-dismiss="popup"
을 사용합니다.
Via data attributes
Via JavaScript
boolean
또는 string
( true , false , static )true
Via data attributes
Via JavaScript
specify static
for a backdrop which doesn’t close the popup on tap.
Via data attributes
or Via JavaScript
.popup(options)
Activates your content as a popup. Accepts an optional options object
.
.popup('toggle')
Manually toggles a popup. Returns to the caller before the popup has actually been shown or hidden (i.e. before the shown.rc.popup
or hidden.rc.popup
event occurs).
.popup('show')
Manually opens a popup. Returns to the caller before the popup has actually been shown (i.e. before the shown.rc.popup
event occurs).
.popup('hide')
Manually hides a popup. Returns to the caller before the popup has actually been hidden (i.e. before the hidden.rc.popup
event occurs).
Bootstrap’s popup class exposes a few events for hooking into popup functionality. All popup events are fired at the popup itself (i.e. at the <div class="popup">
).
Event Type | Description |
---|---|
show.rc.popup | 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.popup | This event is fired when the popup 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.popup | This event is fired immediately when the hide instance method has been called. |
hidden.rc.popup | This event is fired when the popup has finished being hidden from the user (will wait for CSS transitions to complete). |
loaded.rc.popup | data-template 값으로 정해진 원격 마크업이 load 된 후 실행되는 이벤트 |
show.rc.popup
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.popup
This event is fired when the popup 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 popups. To achieve the same effect, use some custom JavaScript:
hide.rc.popup
This event is fired immediately when the hide instance method has been called.
hidden.rc.popup
This event is fired when the popup has finished being hidden from the user (will wait for CSS transitions to complete).
loaded.rc.popup
data-template 값으로 정해진 원격 마크업이 load 된 후 실행되는 이벤트
Have a bunch of buttons that all trigger the same popup, just with slightly different contents? Use event.relatedTarget
and HTML data-*
attributes (possibly via jQuery) to vary the contents of the popup depending on which button was clicked. See the Popup Events docs for details on relatedTarget
. 거의 같은 모달을 작동시키는 몇개의 버튼을 가지고 싶으세요? 버튼이 터치 됨에 따라 달라지는 내용을 위해서 event.relatedTarget
와 HTML data-*
속성을 사용하세요. relatedTarget
에 자세한 것은 팝업 이벤트 문서를 보세요