1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/docs/components/modal.md
Chris Rebert b8fceb17a4 Remove iOS virtual keyboard bug section from docs
The modal backdrop positioning bug related to iOS' virtual keyboard doesn't seem to reproduce in iOS 8.0+.
(Possibly as a side-effect of https://bugs.webkit.org/show_bug.cgi?id=153224 )
Refs #9023
[skip sauce]
2016-03-06 22:57:42 -08:00

20 KiB
Raw Blame History

layout title group
docs Modal components

Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.

Contents

  • Will be replaced with the ToC, excluding the "Contents" header {:toc}

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:

{% highlight js %} $('#myModal').on('shown.bs.modal', function () { $('#myInput').focus() }) {% endhighlight %}

{% callout warning %}

Multiple open modals not supported

Be sure not to open a modal while another is still visible. Showing more than one modal at a time requires custom code. {% endcallout %}

{% callout warning %}

Modal markup placement

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. {% endcallout %}

{% callout warning %}

Mobile device caveats

There are some caveats regarding using modals on mobile devices. [See our browser support docs]({{ site.baseurl }}/getting-started/browsers-devices/#modals-and-dropdowns-on-mobile) for details. {% endcallout %}

Static example

A rendered modal with header, body, and set of actions in the footer.

Modal title

One fine body…

{% highlight html %}

Modal title

One fine body…

{% endhighlight %}

Live demo

Toggle a modal via JavaScript by clicking the button below. It will slide down and fade in from the top of the page.