aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorHans Hillen <hans.hillen@gmail.com>2011-10-19 11:41:33 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-10-19 12:05:37 +0200
commit3c258bfa3ceab51b7e4c847f1196bd64f6c40cee (patch)
tree227db88eb701a9e373a5f636d2b559ccdbdd1a1d /demos
parentbd71f24f5d5c1767f24b3c88df9fab8be38ed734 (diff)
downloadjquery-ui-3c258bfa3ceab51b7e4c847f1196bd64f6c40cee.tar.gz
jquery-ui-3c258bfa3ceab51b7e4c847f1196bd64f6c40cee.zip
Rewrite popup/menu interaction to make popup managed by menu (adds trigger option to menu). Makes popup agnostic of menu and allows datepicker to use popup (soon).
Diffstat (limited to 'demos')
-rw-r--r--demos/menu/contextmenu.html12
-rw-r--r--demos/popup/popup-menu.html24
2 files changed, 15 insertions, 21 deletions
diff --git a/demos/menu/contextmenu.html b/demos/menu/contextmenu.html
index e031c2c4c..961cdd450 100644
--- a/demos/menu/contextmenu.html
+++ b/demos/menu/contextmenu.html
@@ -14,17 +14,17 @@
<link href="../demos.css" rel="stylesheet" />
<script>
$(function() {
- $(".demo button").button({
+ var btn = $(".demo button").button({
icons: {
primary: "ui-icon-home",
secondary: "ui-icon-triangle-1-s"
}
- }).next().menu({
+ });
+ $("#cities").menu({
select: function(event, ui) {
- $(this).hide();
$("#log").append("<div>Selected " + ui.item.text() + "</div>");
- }
- }).popup();
+ },
+ trigger : btn});
});
</script>
<style>
@@ -36,7 +36,7 @@
<div class="demo">
<button>Select a city</button>
- <ul>
+ <ul id="cities">
<li><a href="#Amsterdam">Amsterdam</a></li>
<li><a href="#Anaheim">Anaheim</a></li>
<li><a href="#Cologne">Cologne</a></li>
diff --git a/demos/popup/popup-menu.html b/demos/popup/popup-menu.html
index ddcef4957..8041e2fa3 100644
--- a/demos/popup/popup-menu.html
+++ b/demos/popup/popup-menu.html
@@ -16,16 +16,13 @@
function log( msg ) {
$( "<div/>" ).text( msg ).appendTo( "#log" );
}
- var selected = {
- select: function( event, ui ) {
- log( "Selected: " + ui.item.text() );
- $(this).popup("close");
- }
- };
+ var selected = function( event, ui ) {
+ log( "Selected: " + ui.item.text() );
+ $(this).popup( "close" );
+ }
+
+ $("#button1").button().next().menu( {select: selected, trigger: $("#button1")} );
- $("#button1").button()
- .next().menu(selected).popup();
-
$( "#rerun" )
.button()
.click(function() {
@@ -39,10 +36,7 @@
}
})
.next()
- .menu(selected)
- .popup({
- trigger: $("#select")
- })
+ .menu( {select: selected, trigger: $("#select")} )
.parent()
.buttonset({
items: "button"
@@ -69,8 +63,8 @@
<li><a href="#">Utrecht</a></li>
<li><a href="#">Zurich</a></li>
</ul>
-
-
+
+
<div>
<div>
<button id="rerun">Run last action</button>