Create custom popup

Description

The following code shows how to create custom popup.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.7.1.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css">
<script type='text/javascript'
  src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
<style type='text/css'>
.popMe {<!-- w w w  . ja v a  2  s  .com-->
  width: 500px;
  height: 500px;
  border: 1px solid black;
  background-color: #EEE;
  display: none;
}
</style>
<script type='text/javascript'>//<![CDATA[ 
$(document).on('click', '.trigger', function (event) {
    $('.popMe').each(function() {
        function onFinish() {
            $this.removeClass('reverse out pop in');
        }
        var $this = $(this);
        if ($this.is(':visible')) {
            $this.addClass('reverse out').hide('fast', onFinish);
        } else {
            $this.addClass('ui-panel-active pop in').show('fast', onFinish);
        }
    });
});
//]]>  
</script>
</head>
<body>
  <div id="about" data-role="page">
    <div data-role="header">
      <h1>header</h1>
    </div>
    <a href="#" class="trigger">Show pop</a>
    <div class="popMe">
      <p>Hello World</p>
    </div>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme