Open In App

jQuery Mobile Page corners Option

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 corners option. This option is provided by the dialog extension. The corners option sets the corners of the dialog page to be rounded or not.

Syntax: The corners option takes a boolean value and its default value is “true”, which means the corners will be rounded.

$("#gfgDialogPage").page({
    corners: true
});

After initialization, get or set the corners option using the following syntax.

  • Get corners option:

    var cornersOption = $("#gfgDialogPage").page("option", "corners");
  • Set corners option:

    $("#gfgDialogPage").page("option", "corners", true);

CDN Links: Use the following CDN links for your project.

<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 corners option to “false”. The dialog will have sharp corners.

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 corners Option</h3>
            <center>
                <a href="#gfgDialogPage" data-rel="dialog" 
                   style="color:darkgreen; text-decoration:none;">
                   Open dialog
                </a>
            </center>
        </div>
    </div>
    <div data-role="page" id="gfgDialogPage">
        <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() {
                $("#gfgDialogPage").page({
                    dialog: true,
                    corners: false
                });
            });
    </script>
</body>
</html>


Output:

jQuery Mobile Page corners Option

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



Last Updated : 20 Jan, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads