jQuery Mobile - Pre-rendered Popup Markup



Description

You can use pre-rendered markup in the popup to save the startup time.

Example

Following example demonstrates the use of popup pre-rendered markup in the jQuery Mobile Framework.

<!DOCTYPE html>
<html>
   <head>
      <title>Popup Pre-rendered Markup</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>

   <body>
      <div data-role = "page">
         <div data-role = "header">
            <h2>Pre-rendered Popup Markup</h2>
         </div>
         
         <div role = "main" class = "ui-content">
            <a href = "#pre-rendered" data-rel = "popup" class = "ui-btn ui-btn-inline">
               Open Popup</a>
         </div>
         
         <div id = "pre-rendered-screen" class = "ui-popup-screen ui-screen-hidden"></div>
         <div id = "pre-rendered-popup" class = "ui-popup-container fade ui-popup-hidden 
            ui-body-inherit  ui-overlay-shadow">
         
            <div id = "pre-rendered" class = "ui-popup" data-role = "popup" 
               data-transition = "slideup">
               <p>Welcome to Tutorialspoint...</p>
            </div>
         </div>
      
         <div data-role = "footer">
            <h2>Footer</h2>
         </div>
         
      </div>
   </body>
</html>

Output

Let's carry out the following steps to see how the above code works −

  • Save the above html code as jqm_pre-rendered_popup_markup.html file in your server root folder.

  • Open this HTML file as http://localhost/jqm_pre-rendered_popup_markup.html and the following output will be displayed.

jquery_mobile_widgets.htm
Advertisements