2010-06-18 08:23:41 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "UTF-8" / >
< title > jQuery UI Menu - Contextmenu demo< / title >
2011-05-08 18:41:21 +00:00
< link href = "../../themes/base/jquery.ui.all.css" rel = "stylesheet" / >
2011-07-25 15:46:45 +00:00
< script src = "../../jquery-1.6.2.js" > < / script >
2011-05-08 18:41:21 +00:00
< 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 >
2010-06-18 08:23:41 +00:00
$(function() {
2010-06-19 14:37:39 +00:00
$(".demo button").button({
icons: {
primary: "ui-icon-home",
secondary: "ui-icon-triangle-1-s"
}
2011-05-08 18:41:21 +00:00
}).next().menu({
select: function(event, ui) {
$(this).hide();
$("#log").append("< div > Selected " + ui.item.text() + "< / div > ");
2010-06-18 08:23:41 +00:00
}
2011-05-08 18:41:21 +00:00
}).popup();
2010-06-18 08:23:41 +00:00
});
< / script >
< style >
.ui-menu { width: 200px; position: absolute; }
< / style >
< / head >
< body >
< div class = "demo" >
< button > Select a city< / button >
< ul >
2011-05-11 11:39:58 +00:00
< li > < a href = "#Amsterdam" > Amsterdam< / a > < / li >
< li > < a href = "#Anaheim" > Anaheim< / a > < / li >
< li > < a href = "#Cologne" > Cologne< / a > < / li >
< li > < a href = "#Frankfurt" > Frankfurt< / a > < / li >
< li > < a href = "#Magdeburg" > Magdeburg< / a > < / li >
< li > < a href = "#Munich" > Munich< / a > < / li >
< li > < a href = "#Utrecht" > Utrecht< / a > < / li >
< li > < a href = "#Zurich" > Zurich< / a > < / li >
2010-06-18 08:23:41 +00:00
< / ul >
2011-07-27 13:54:40 +00:00
2010-06-18 08:23:41 +00:00
< div id = "log" > < / div >
< / div > <!-- End demo -->
< div class = "demo-description" >
2011-07-27 13:54:40 +00:00
< 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 >
2010-06-18 08:23:41 +00:00
< 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 >
< / div > <!-- End demo - description -->
< / body >
< / html >