#

Navigation Search

- Accordion
- AJAX Navigation
- Autocomplete
- Buttons
- Checkboxes
- Collapsibles
- Controlgroup
- Filterable New
- Dialogs
- Fixed toolbars
- Flip switch, slider
- Flip switch New
- Footer toolbar
- Form elements
- Grids
- Header toolbar
- Icons New
- Links
- Listviews
- Loader
- Navbar
- Navbar, persistent
- Pages
- Panels
- Popup
- Radio buttons
- Select
- Select, custom
- Slider, single
- Slider, dual range
- Table, column toggle
- Table, reflow
- Text inputs & textarea
- Transitions
- Collapsibles
- Dynamic collapsible
- Controlgroups
- Dynamic controlgroup
- Filterable
- Filterable inside custom select
- Listviews
- Grid Listview
- Autodividers Linkbar
- Autodividers Selector
- Maps
- Google Maps & Geolocation
- Google Maps with List toggle
- Navigation
- Backbone and Require.js example
- Redirection with server-side support
- Panels
- Panel styling
- Open panel on swipe
- Popups
- Dynamic popup
- Popup arrow size
- Popup alignment
- Responsive Tables
- Reflow: Custom styles
- Reflow: Heading groups
- Column toggle: Customization options
- Column toggle: Heading groups
- Column toggle demo: Phone comparison
- Sliders
- Tooltip extension
- Swipe
- Swipe to navigate
- Swipe to delete list item
- Forms
- Why won't my CSS styles apply correctly to a widget?
- Updating the value of enhanced form elements does not work.
- My HTML 5 inputs look different across devices and browsers.
- My range or search inputs are being change to number/text.
- Sometimes my custom select shows as a popup other times its a dialog.
- Disabling a button does not work.
- Controls in my fixed header or footer are not responding or behave erratically.
- Pages
- Why aren't my scripts and styles loading?
- Why isn't DOM ready working for my scripts?
- How do I load a page?
- Why is only the first page of my multi page document loaded?
- I'm trying to pass query params to a page but it's not working?
- I'm trying to pass information via the hash but it's not working?
- I'm trying to use the application cache but it's not working.
- Content injected into a page is not enhanced.
- Triggering create on injected HTML does not work.
- How can I stop JQM from auto-enhancing an element?
- How can I stop JQM from enhancing a block of elements?
- How do I control page titles?
- How do I load a page?
- How do I turn off the automatic hiding of the url bar?
- Events
- How do I use touch and mouse events?
- Theme and styling
- How does theming work?
- Apps
- How do I need to configure PhoneGap/Cordova?

# Popup API

The popup widget can be used for various types of popups. From a small tooltip popup to a large photo lightbox.

## Popup basics

To create a popup, add the `data-role="popup"` attribute to a div with the popup contents. Then create a link with the `href` set to the `id` of the popup div, and add the attribute `data-rel="popup"` to tell the framework to open the popup when the link is tapped. A popup div has to be nested inside the same page as the link.

Basic Popup

This is a completely basic popup, no options set.

## Tooltip

A tooltip can be created by adding a theme swatch to a basic popup and adding padding via the `ui-content` class.

A paragraph with a tooltip. Learn more

Here is a tiny popup being used like a tooltip. The text will wrap to multiple lines as needed.

## Photo lightbox

A lightbox for displaying images can be created easily by placing an image in a popup. In this example, a close button is added to the markup by adding a link. The `data-overlay-theme="a"` attribute adds a dark backdrop behind the photos. For advanced photo techniques, see scaling images in popups.

Close
Close
Close

## Menu

A menu can be created by adding a listview inside a popup.

Actions...

- Choose an action
- View details
- Edit
- Disable
- Delete

## Nested menu

A nested menu can be created by placing listviews into an accordion inside a popup.

Choose a creature...

## Farm animals

- Chicken
- Cow
- Duck
- Sheep

## Pets

- Cat
- Dog
- Iguana
- Mouse

## Ocean Creatures

- Fish
- Octopus
- Shark
- Starfish

## Wild Animals

- Lion
- Monkey
- Tiger
- Zebra

## Form

You can place a form inside a popup. When it opens, focus will be restricted to elements inside the popup.

Sign in

### Please sign in

Username: Password:

## Dialog

Standard dialog markup can be placed into a popup. To create a modal style dialog, add the `data-dismissible="false"` attribute to the popup to prevent the click-outside-to-close behavior so people need to interact with popup buttons to close it.

Delete page...

# Delete Page?

### Are you sure you want to delete this page?

This action cannot be undone.

Cancel Delete

## Adding padding

For popups with formatted text, padding is needed. The `ui-content` class can be added to the popup to add the standard 15px of padding. When padding is added, we apply a few style rules to negate the top margin for the first heading or paragraph in the popup and do the same for the last element's bottom margin.

Popup with padding

This is a popup with the `ui-content` class added to the popup container.

## Closing popups

By default popups can be closed either by clicking outside the popup widget or by pressing the `Esc` key. To prevent this, the `data-dismissible="false"` attribute can be added to the popup. To add an explicit close button to a popup, add a link with the role of button into the popup container with a `data-rel="back"` attribute and position via a class.

Right close button Left close button Undismissible Popup
Close

I have a close button at the top right corner with simple HTML markup.

Close

I have a close button at the top left corner with simple HTML markup.

Close

I have the `data-dismissible` attribute set to `false`. I'm not closeable by clicking outside of me.

## Position

By default, popups open centered vertically and horizontally over the element you clicked (the origin) which is good for popups used as tooltips or menus. If a popup should appear centered within the window instead of over the origin, add the `data-position-to` attribute to the link and specify a value of `window`. It's also possible to specify any valid selector as the value of `position-to` in addition to `origin` and `window`.

Position to window Position to origin Position to #position-header

I am positioned to the window.

I am positioned over the origin.

I am positioned over the header for this section via a selector. If the header isn't scrolled into view, collision detection will place the popup so it's in view.

## Transitions

By default, popups have no transition to make them open as quickly as possible. To set the transition used for a popup, add the `data-transition` attribute to the link that references the popup. The reverse transition will be used when closing the popup. For performance reasons on mobile devices, we recommend using simpler transitions like pop, fade or none for smooth and fast popup animations.

No transition Pop Fade Flip Turn Flow Slide Slidefade Slide up Slide down

I'm a simple popup.

## Theme

The popup has two theme-related options: `data-theme` and `data-overlay-theme`. The `data-theme` option refers to the theme of the popup itself, whereas `data-overlay-theme` controls the semi-opaque layer behind the popup. The theme is inherited from the page; specify `data-theme="none"` for a popup with a transparent background.

Theme A

I have `data-theme="a"` set on me

Theme "none", no shadow
Close
Overlay theme A

I have a `data-overlay-theme="a"` set on me

Theme B + overlay A

I have `data-theme="b"` and `data-overlay-theme="a"` set on me

## Arrow

The popup can display an arrow along one of its edges when it opens if the `data-arrow` attribute is set. The attribute can take a value of `true`, `false`, or a string containing a comma-separated list of edge abbreviations ("l" for left, "t" for top, "r" for right, and "b" for bottom). For example, if you set `data-arrow="r,b"` then the arrow will only ever appear along the bottom or right edge of the popup. `true` is the same as `"l,t,r,b"` and `false` or `""` indicates that the popup should be displayed without an arrow.

Click in the pink area below to display a popup with an arrow.

A paragraph inside the popup with an arrow.

This second paragraph serves to increase the height of the popup

## Pre-rendered markup

You can supply pre-rendered popup markup to save startup time. The page in the example below contains a popup with pre-rendered markup supplied as part of the original page markup.

Go to demo

## Advanced techniques

Learn how to customize and extend popups by working with the API, custom scripts, and styles.

Scaling images Map + video iframes

# Pre-rendered popup demo

Open Popup

This is the contents of the pre-rendered popup