jQuery Mobile: A popup menu

This entry is part 59 of 73 in the series jQuery Mobile

A menu can be created by adding a listview inside a popup.

The 3 main lines are highlighted below.

In line 16, the href has a data relationship with the <div> with the popup datarole.

Popup Menu
<!DOCTYPE html>
    <link href='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js'></script>
<div data-role='page'>
    <div data-role='header' data-theme='b'>
        <h1>A Popup Menu App</h1>

    <div data-role='content'>
        <a href='#popupMenu' 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'>Actions...</a>
        <div data-role='popup' id='popupMenu' data-theme='b'>
            <ul data-role='listview' data-inset='true' style='min-width:210px;'>
                <li data-role='list-divider'>Choose an action</li>
                <li><a href='#'>View details</a></li>
                <li><a href='#'>Edit</a></li>
                <li><a href='#'>Disable</a></li>
                <li><a href='#'>Delete</a></li>

    <div data-role='footer' data-position='fixed'>
        <h4 style='text-align:center;'>I'm the footer</h4>

Try The Code
Series Navigation<< jQuery Mobile: Photo Lightbox
jQuery Mobile: Popup nested menu >>

Leave a comment

Leave a Reply