aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-05-08 20:41:21 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-05-08 20:41:21 +0200
commite6d1ab7bf40e7ecaaaea0d53407dc98a416cc054 (patch)
tree6c4f5f12864949eab4aa176cccb3411942b3c81a /demos
parent24c0d9195a3ae84bf6fe4698926fafafa55b2bdf (diff)
downloadjquery-ui-e6d1ab7bf40e7ecaaaea0d53407dc98a416cc054.tar.gz
jquery-ui-e6d1ab7bf40e7ecaaaea0d53407dc98a416cc054.zip
Popup and Menubar demos
Diffstat (limited to 'demos')
-rw-r--r--demos/demos.css3
-rw-r--r--demos/index.html4
-rw-r--r--demos/menu/contextmenu.html48
-rw-r--r--demos/menu/default.html12
-rw-r--r--demos/menu/index.html2
-rw-r--r--demos/menubar/default.html234
-rw-r--r--demos/menubar/index.html16
-rw-r--r--demos/popup/default.html83
-rw-r--r--demos/popup/index.html18
-rw-r--r--demos/popup/popup-menu-table.html108
-rw-r--r--demos/popup/popup-menu.html98
11 files changed, 585 insertions, 41 deletions
diff --git a/demos/demos.css b/demos/demos.css
index f5f2dbe64..cf6da8bd1 100644
--- a/demos/demos.css
+++ b/demos/demos.css
@@ -129,8 +129,7 @@ eventually we should convert the font sizes to ems -- using px for now to minimi
.normal h3.demo-header { font-size:32px; padding:0 0 5px; border-bottom:1px solid #eee; text-transform: capitalize; }
.normal h4.demo-subheader { font-size:10px; text-transform: uppercase; color:#999; padding:8px 0 3px; border:0; margin:0; }
-.normal a:link,
-.normal a:visited { color:#1b75bb; text-decoration:none; }
+#demo-notes a, #demo-link a, #demo-source a { color:#1b75bb; text-decoration:none; }
.normal a:hover,
.normal a:active { color:#0b559b; }
diff --git a/demos/index.html b/demos/index.html
index 22dbfc5c5..b1cfcdd44 100644
--- a/demos/index.html
+++ b/demos/index.html
@@ -20,6 +20,8 @@
<script src="../ui/jquery.ui.draggable.js"></script>
<script src="../ui/jquery.ui.droppable.js"></script>
<script src="../ui/jquery.ui.menu.js"></script>
+ <script src="../ui/jquery.ui.menubar.js"></script>
+ <script src="../ui/jquery.ui.popup.js"></script>
<script src="../ui/jquery.ui.position.js"></script>
<script src="../ui/jquery.ui.progressbar.js"></script>
<script src="../ui/jquery.ui.resizable.js"></script>
@@ -279,6 +281,8 @@
<dd><a href="datepicker/index.html">Datepicker</a></dd>
<dd><a href="dialog/index.html">Dialog</a></dd>
<dd><a href="menu/index.html">Menu</a></dd>
+ <dd><a href="menubar/index.html">Menubar</a></dd>
+ <dd><a href="popup/index.html">Popup</a></dd>
<dd><a href="progressbar/index.html">Progressbar</a></dd>
<dd><a href="slider/index.html">Slider</a></dd>
<dd><a href="spinner/index.html">Spinner</a></dd>
diff --git a/demos/menu/contextmenu.html b/demos/menu/contextmenu.html
index 0fb98c140..115f15b24 100644
--- a/demos/menu/contextmenu.html
+++ b/demos/menu/contextmenu.html
@@ -3,44 +3,28 @@
<head>
<meta charset="UTF-8" />
<title>jQuery UI Menu - Contextmenu demo</title>
- <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
- <script type="text/javascript" src="../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
- <script type="text/javascript">
+ <link href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <link href="../demos.css" rel="stylesheet" />
+ <script>
$(function() {
$(".demo button").button({
icons: {
primary: "ui-icon-home",
secondary: "ui-icon-triangle-1-s"
}
- }).each(function() {
- $(this).next().menu({
- select: function(event, ui) {
- $(this).hide();
- $("#log").append("<div>Selected " + ui.item.text() + "</div>");
- }
- }).hide();
- }).click(function(event) {
- var menu = $(this).next();
- if (menu.is(":visible")) {
- menu.hide();
- return false;
+ }).next().menu({
+ select: function(event, ui) {
+ $(this).hide();
+ $("#log").append("<div>Selected " + ui.item.text() + "</div>");
}
- menu.menu("blur").show().position({
- my: "left top",
- at: "right top",
- of: this
- });
- $(document).one("click", function() {
- menu.hide();
- });
- return false;
- })
+ }).popup();
});
</script>
<style>
@@ -69,7 +53,7 @@
<div class="demo-description">
-<p>A simple contextmenu: Click the button, or tab to it and hit space to open the menu. Use the mouse or cursor keys to select an item, click it or hit enter to select it.</p>
+<p>TODO update - A simple contextmenu: Click the button, or tab to it and hit space to open the menu. Use the mouse or cursor keys to select an item, click it or hit enter to select it.</p>
<p>The keyboard handling is part of the menu. Using the input option to menu is configured to add the key event handlers to the button, as that button gets focused when clicked.</p>
diff --git a/demos/menu/default.html b/demos/menu/default.html
index 2d9dddf28..7a1dd99e7 100644
--- a/demos/menu/default.html
+++ b/demos/menu/default.html
@@ -4,12 +4,12 @@
<meta charset="UTF-8" />
<title>jQuery UI Menu - Default demo</title>
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
- <script type="text/javascript" src="../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
- <script type="text/javascript">
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <link href="../demos.css" rel="stylesheet" />
+ <script>
$(function() {
$(".demo ul").menu();
});
diff --git a/demos/menu/index.html b/demos/menu/index.html
index cfc12bc1d..3088f9d7d 100644
--- a/demos/menu/index.html
+++ b/demos/menu/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<title>jQuery UI Menu Demos</title>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <link href="../demos.css" rel="stylesheet" />
</head>
<body>
<div class="demos-nav">
diff --git a/demos/menubar/default.html b/demos/menubar/default.html
new file mode 100644
index 000000000..be49b4589
--- /dev/null
+++ b/demos/menubar/default.html
@@ -0,0 +1,234 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Menubar - Default demo</title>
+ <link rel="stylesheet" href="../demos.css" type="text/css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.menubar.js"></script>
+ <script>
+ $(function() {
+ $("td:has(.menubar)").clone().appendTo("tbody tr:not(:first)");
+
+ $("#bar1, .menubar").menubar({
+ select: function(event, ui) {
+ $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
+ }
+ });
+
+ $(".menubar-icons").menubar({
+ menuIcon: true,
+ buttons: true,
+ select: function(event, ui) {
+ $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
+ }
+ });
+ });
+ </script>
+ <style type="text/css">
+ #bar1, #bar2 { margin: 0 0 4em; } /* style for this page only */
+ .ui-menu { width: 200px; position: absolute; outline: none; z-index: 9999; }
+ .ui-menu .ui-icon { float: right; }
+ .ui-menu li.ui-state-disabled {
+ font-weight: bold;
+ padding: .0em .4em;
+ margin: .4em 0 .2em;
+ line-height: 1.5;
+ }
+
+ /* menubar styles */
+ .ui-menubar .ui-button { float: left; font-weight: normal; border-top-width: 0 !important; border-bottom-width: 0 !important; margin: 0; outline: none; }
+ .ui-menubar .ui-menubar-link { border-right: 1px dashed transparent; border-left: 1px dashed transparent; }
+
+ .ui-menubar {
+ list-style: none;
+ margin: 0;
+ padding-left: 0;
+ }
+
+ .ui-menubar-item {
+ float: left;
+ }
+ /*
+ table {
+ border-collapse: collapse;
+ }
+ th, td {
+ padding: 0.5em;
+ border: 1px solid black;
+ }
+ */
+ </style>
+</head>
+<body>
+
+<div class="demo">
+<ul id="bar1" class="menubar">
+ <li>
+ <a href="#">File</a>
+ <ul>
+ <li><a href="#">Open...</a></li>
+ <li class="ui-state-disabled">Open recent...</li>
+ <li><a href="#">Save</a></li>
+ <li><a href="#">Save as...</a></li>
+ <li><a href="#">Close</a></li>
+ <li><a href="#">Quit</a></li>
+ </ul>
+ </li>
+ <li>
+ <a href="#">Edit</a>
+ <ul>
+ <li><a href="#">Copy</a></li>
+ <li><a href="#">Cut</a></li>
+ <li class="ui-state-disabled">Paste</li>
+ </ul>
+ </li>
+ <li>
+ <a href="#">View</a>
+ <ul>
+ <li><a href="#">Fullscreen</a></li>
+ <li><a href="#">Fit into view</a></li>
+ <li>
+ <a href="#">Encoding</a>
+ <ul>
+ <li><a href="#">Auto-detect</a></li>
+ <li><a href="#">UTF-8</a></li>
+ <li>
+ <a href="#">UTF-16</a>
+ <ul>
+ <li><a href="#">Option 1</a></li>
+ <li><a href="#">Option 2</a></li>
+ <li><a href="#">Option 3</a></li>
+ <li><a href="#">Option 4</a></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li><a href="#">Customize...</a></li>
+ </ul>
+ </li>
+</ul>
+
+<ul id="bar2" class="menubar-icons">
+ <li>
+ <a href="#">File</a>
+ <ul>
+ <li><a href="#">Open...</a></li>
+ <li class="ui-state-disabled">Open recent...</li>
+ <li><a href="#">Save</a></li>
+ <li><a href="#">Save as...</a></li>
+ <li><a href="#">Close</a></li>
+ <li><a href="#">Quit</a></li>
+ </ul>
+ </li>
+ <li>
+ <a href="#">Edit</a>
+ <ul>
+ <li><a href="#">Copy</a></li>
+ <li><a href="#">Cut</a></li>
+ <li class="ui-state-disabled">Paste</li>
+ </ul>
+ </li>
+ <li>
+ <a href="#">View</a>
+ <ul>
+ <li><a href="#">Fullscreen</a></li>
+ <li><a href="#">Fit into view</a></li>
+ <li>
+ <a href="#">Encoding</a>
+ <ul>
+ <li><a href="#">Auto-detect</a></li>
+ <li><a href="#">UTF-8</a></li>
+ <li>
+ <a href="#">UTF-16</a>
+ <ul>
+ <li><a href="#">Option 1</a></li>
+ <li><a href="#">Option 2</a></li>
+ <li><a href="#">Option 3</a></li>
+ <li><a href="#">Option 4</a></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li><a href="#">Customize...</a></li>
+ </ul>
+ </li>
+</ul>
+
+<!--
+<table id="movies" class="ui-widget">
+ <thead>
+ <tr>
+ <th data-field="Name" class="ui-widget-header">Name</th>
+ <th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
+ <th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
+ <th class="ui-widget-header"></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
+ <td class="ui-widget-content">1993</td>
+ <td class="ui-widget-content">3.6</td>
+ <td class="ui-widget-content">
+ <ul class="menubar">
+ <li>
+ <a href="#">Options</a>
+ <ul>
+ <li><a href="#">Order...</a></li>
+ <li class="ui-state-disabled">Write a Review...</li>
+ <li><a href="#">Find Similar Movies...</a></li>
+ <li>
+ <a href="#">Rate</a>
+ <ul>
+ <li><a href="#">5 stars</a></li>
+ <li><a href="#">4 stars</a></li>
+ <li><a href="#">3 stars</a></li>
+ <li><a href="#">2 stars</a></li>
+ <li><a href="#">1 stars</a></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
+ <td class="ui-widget-content">1991</td>
+ <td class="ui-widget-content">3.1</td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
+ <td class="ui-widget-content">1991</td>
+ <td class="ui-widget-content">3.9</td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Spike and Mike's Sick &amp; Twisted Festival of Animation</td>
+ <td class="ui-widget-content">1997</td>
+ <td class="ui-widget-content">2.6</td>
+ </tr>
+ </tbody>
+</table>
+-->
+
+<div class="ui-widget" style="margin-top:2em; font-family:Arial">
+ Log:
+ <div id="log" style="height: 100px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
+</div>
+</div>
+
+<div class="demo-description">
+
+<p>TODO</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>
diff --git a/demos/menubar/index.html b/demos/menubar/index.html
new file mode 100644
index 000000000..3eebda2d0
--- /dev/null
+++ b/demos/menubar/index.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Menubar Demos</title>
+ <link href="../demos.css" rel="stylesheet" />
+</head>
+<body>
+ <div class="demos-nav">
+ <h4>Examples</h4>
+ <ul>
+ <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
+ </ul>
+ </div>
+</body>
+</html>
diff --git a/demos/popup/default.html b/demos/popup/default.html
new file mode 100644
index 000000000..71b3c8dd2
--- /dev/null
+++ b/demos/popup/default.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Popup - Default demo</title>
+ <link rel="stylesheet" href="../demos.css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <script>
+ $(function() {
+ var selected = {
+ select: function( event, ui ) {
+ $( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
+ $(this).popup("close");
+ }
+ };
+
+ $("#login-form").popup()
+ .find(":submit").button().click(function(event) {
+ event.preventDefault();
+ });
+ });
+ </script>
+ <style type="text/css">
+ .ui-popup { position: absolute; z-index: 5000; }
+ .ui-menu { width: 200px; }
+
+ /*
+ table {
+ border-collapse: collapse;
+ }
+ th, td {
+ padding: 0.5em;
+ border: 1px solid black;
+ }
+ */
+
+ #login-form {
+ width: 16em; border: 1px solid gray; border-radius: 5px;
+ padding: 1em;
+ box-shadow: 3px 3px 5px -1px rgba(0, 0, 0, 0.5);
+ background: lightgray; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));
+ font-size: 1.3em; outline: none;
+ }
+ #login-form label { display: inline-block; width: 5em; }
+ #login-form .submit { margin-left: 5em; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+ <a href="#login-form">Log In</a>
+ <div id="login-form" class="ui-widget-content" tabIndex="0">
+ <form>
+ <div>
+ <label>Username</label>
+ <input type="username" />
+ </div>
+ <div>
+ <label>Password</label>
+ <input type="password" />
+ </div>
+ <div>
+ <input type="submit" class="submit" value="Login" />
+ </div>
+ </form>
+ </div>
+</div>
+
+<div class="demo-description">
+
+<p>A link to a login form that opens as a popup. [Not quite functional, focus handling needs to get better]</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>
diff --git a/demos/popup/index.html b/demos/popup/index.html
new file mode 100644
index 000000000..e69365c98
--- /dev/null
+++ b/demos/popup/index.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Popup Demos</title>
+ <link href="../demos.css" rel="stylesheet" />
+</head>
+<body>
+ <div class="demos-nav">
+ <h4>Examples</h4>
+ <ul>
+ <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
+ <li><a href="popup-menu.html">Menu's as popup</a></li>
+ <li><a href="popup-menu-table.html">Menu's as popup in a table</a></li>
+ </ul>
+ </div>
+</body>
+</html>
diff --git a/demos/popup/popup-menu-table.html b/demos/popup/popup-menu-table.html
new file mode 100644
index 000000000..a06a38434
--- /dev/null
+++ b/demos/popup/popup-menu-table.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Popup - Menu as Popup in table demo</title>
+ <link rel="stylesheet" href="../demos.css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <script>
+ $(function() {
+ var selected = {
+ select: function( event, ui ) {
+ $( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
+ $(this).popup("close");
+ }
+ };
+
+ $(".demo td:has(.menubar)").clone().appendTo(".demo tbody tr:not(:first)");
+ $("table .menubar > ul").menu(selected).popup().prev().button();
+ });
+ </script>
+ <style type="text/css">
+ .ui-popup { position: absolute; z-index: 5000; }
+ .ui-menu { width: 200px; }
+
+ .demo table {
+ border-collapse: collapse;
+ }
+ .demo th, .demo td {
+ padding: 0.5em;
+ }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <table id="movies" class="ui-widget">
+ <thead>
+ <tr>
+ <th data-field="Name" class="ui-widget-header">Name</th>
+ <th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
+ <th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
+ <th class="ui-widget-header"></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
+ <td class="ui-widget-content">1993</td>
+ <td class="ui-widget-content">3.6</td>
+ <td class="ui-widget-content">
+ <div class="menubar">
+ <a href="#">Options</a>
+ <ul>
+ <li><a href="#">Order...</a></li>
+ <li class="ui-state-disabled">Write a Review...</li>
+ <li><a href="#">Find Similar Movies...</a></li>
+ <li>
+ <a href="#">Rate</a>
+ <ul>
+ <li><a href="#">5 stars</a></li>
+ <li><a href="#">4 stars</a></li>
+ <li><a href="#">3 stars</a></li>
+ <li><a href="#">2 stars</a></li>
+ <li><a href="#">1 stars</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
+ <td class="ui-widget-content">1991</td>
+ <td class="ui-widget-content">3.1</td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
+ <td class="ui-widget-content">1991</td>
+ <td class="ui-widget-content">3.9</td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Spike and Mike's Sick &amp; Twisted Festival of Animation</td>
+ <td class="ui-widget-content">1997</td>
+ <td class="ui-widget-content">2.6</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div id="log"></div>
+</div>
+
+
+<div class="demo-description">
+
+<p>Poup menu in a table. Works okay standalone, not so much in the scrolling demo view. For that to work better, position() would have to take the closest scrolled parent into account for collision detection.</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>
diff --git a/demos/popup/popup-menu.html b/demos/popup/popup-menu.html
new file mode 100644
index 000000000..7152d85bc
--- /dev/null
+++ b/demos/popup/popup-menu.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Popup - Popup Menu</title>
+ <link rel="stylesheet" href="../demos.css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <script>
+ $(function() {
+ function log( msg ) {
+ $( "<div/>" ).text( msg ).appendTo( "#log" );
+ }
+ var selected = {
+ select: function( event, ui ) {
+ log( "Selected: " + ui.item.text() );
+ $(this).popup("close");
+ }
+ };
+
+ $("#button1").button()
+ .next().menu(selected).popup();
+
+ $( "#rerun" )
+ .button()
+ .click(function() {
+ log( "Selected: " + $( this ).text() );
+ })
+ .next()
+ .button({
+ text: false,
+ icons: {
+ primary: "ui-icon-triangle-1-s"
+ }
+ })
+ .next()
+ .menu(selected)
+ .popup({
+ trigger: $("#select")
+ })
+ .parent()
+ .buttonset({
+ items: "button"
+ });
+ });
+ </script>
+ <style type="text/css">
+ .ui-popup { position: absolute; z-index: 5000; }
+ .ui-menu { width: 200px; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <button id="button1">Show context menu 1</button>
+ <ul>
+ <li><a href="#">Amsterdam</a></li>
+ <li><a href="#">Anaheim</a></li>
+ <li><a href="#">Cologne</a></li>
+ <li><a href="#">Frankfurt</a></li>
+ <li><a href="#">Magdeburg</a></li>
+ <li><a href="#">Munich</a></li>
+ <li><a href="#">Utrecht</a></li>
+ <li><a href="#">Zurich</a></li>
+ </ul>
+
+
+ <div>
+ <div>
+ <button id="rerun">Run last action</button>
+ <button id="select">Select an action</button>
+ <ul>
+ <li><a href="#">Open...</a></li>
+ <li><a href="#">Save</a></li>
+ <li><a href="#">Delete</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <div id="log"></div>
+</div>
+
+
+<div class="demo-description">
+
+<p>Make the popup a menu (or the menu a popup) and you get context menus.</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>