0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-30 12:24:19 +01:00
Bootstrap/docs/components/modal.md
Mark Otto 7bf868a709 v4: Social meta tags (#20825)
* descriptions for getting started pages

* descriptions for layout

* add content page descriptions

* more descriptions, updates to some existing ones

* correct site url

* add social stuff to config for twitter cards

* add twitter meta tags; use large image for homepage and regular card for all others

* add the assets

* more site config

* more social shiz to partial, remove existing meta for the partial, remove page title from homepage for simpler if statements
2016-10-02 18:19:47 -07:00

20 KiB
Raw Blame History

layout title description group
docs Modal Learn how to use Bootstrap's modals to add dialog prompts to your site. 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…

Close Save changes

{% highlight html %}

Modal title

One fine body…

Close Save changes
{% 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.