Open In App

jQuery Mobile Page overlayTheme Option

Last Updated : 20 Jan, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

jQuery Mobile is an HTML5 based user interface system designed to make responsive websites and apps that are accessible on all smartphone, tablet, and desktop devices.

Page is a widget in jQuery Mobile to display single or multiple linked components within the HTML document. It is responsible for maintaining a single item in jQuery Mobile’s framework. 

In this article, we are going to learn the jQuery Mobile Page overlayTheme option. The overlayTheme option is used for the dialog widgets appearing over the page.  The dialogs appear over a layer which by default has the theme of “a” but can be changed.

Syntax: The overlayTheme option takes a single character from a-z where each character depicts a color. The default value is ‘a’.

$("#dialogPage").page({
    overlayTheme: "b",
});
  • Get the overlayTheme option:

    var overlayTheme = $("#dialogPage").page( "option", "overlayTheme" );
  • Set the overlayTheme option:

    $("#dialogPage").page( "option", "overlayTheme", "b" );

CDN Links: The CDN links for the jQuery Mobile project are as follows.

<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.1.min.js”></script>
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>

Example: In the following example, we have set the overlayTheme to dark color using the character “b”.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content=
        "width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href=
    <script src=
    </script>
    <script src=
    </script>
</head>
  
<body>
    <div data-role="page" id="gfgpage">
        <div data-role="header">
            <h1 style="color:green;">GeeksforGeeks</h1>
        </div>
        <div data-role="main" class="ui-content">
            <h3>jQuery Mobile Page overlayTheme Option</h3>
            <a href="#dialogPage" data-rel="dialog" 
               data-transition="pop">
               Open dialog
             </a>
        </div>
    </div>
    <div data-role="page" id="dialogPage" data-theme="b" 
         data-dialog="true">
        <div data-role="header">
            <h2>GeeksforGeeks</h2>
        </div>
        <div role="main" class="ui-content">
            <p>A computer science for geeks</p>
  
        </div>
    </div>
    <script>
        $(document).ready(function(){
            $("#dialogPage").page({
                overlayTheme: "b",
            });
        }); 
    </script>
</body>
</html>


Output:

jQuery Mobile Page overlayTheme Option

Reference: https://api.jquerymobile.com/page/#option-overlayTheme



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads