How to create a Menu popup using jQuery Mobile ?

jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating menu popup button using jQuery Mobile.

Approach: Add jQuery Mobile scripts needed for your project.

<link rel=”stylesheet” href=”http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css” />

<script src=”http://code.jquery.com/jquery-1.11.1.min.js”></script>

<script src=”http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>

Example: We will create a menu popup by adding a listview inside a popup.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" href=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
  
    <script src=
        "http://code.jquery.com/jquery-1.11.1.min.js">
    </script>
  
    <script src=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js">
    </script>
</head>
  
<body>
    <center>
        <h1>w3wiki</h1>
  
        <h4>
            Menu popup using jQuery Mobile
        </h4>
  
        <a href="#GFGMenu" data-rel="popup" 
            data-transition="slideup"
            class="ui-btn ui-corner-all ui-shadow 
            ui-btn-inline ui-icon-gear 
            ui-btn-icon-left ui-btn-a"
            title="Click Here!">w3wiki Menu
        </a>
  
        <div data-role="popup" id="GFGMenu" data-theme="b">
            <ul data-role="listview" data-inset="true" 
                style="min-width:210px;">
                  
                <li data-role="list-divider">Choose an Option</li>
                <li><a href="#">Data Structure</a></li>
                <li><a href="#">Algorithm</a></li>
                <li><a href="#">HTML</a></li>
                <li><a href="#">CSS</a></li>
                <li><a href="#">JavaScript</a></li>
            </ul>
        </div>
    </center>
</body>
  
</html>


Output: