|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> |
| 5 | + <title>Widget test</title> |
| 6 | + <link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" /> |
| 7 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> |
| 8 | + <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript"></script> |
| 9 | + |
| 10 | + <script src="jquery.contextmenu.js" type="text/javascript"></script> |
| 11 | + |
| 12 | +<style type="text/css"> |
| 13 | +body{ |
| 14 | + font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif"; |
| 15 | + font-size: 62.5%; |
| 16 | +} |
| 17 | +.menuTargets span { |
| 18 | + border: 2px outset black; |
| 19 | + padding: 3px; |
| 20 | +} |
| 21 | +</style> |
| 22 | + |
| 23 | +<!-- Add code to initialize the tree when the document is loaded: --> |
| 24 | +<script type="text/javascript"> |
| 25 | +$(function(){ |
| 26 | + $("button#split").contextmenu({ |
| 27 | + menu: "#splitOptions", |
| 28 | + click: function(event){ |
| 29 | + alert("clicked default button"); |
| 30 | + }, |
| 31 | + focus: function(event, ui){ |
| 32 | +// alert("focus"); |
| 33 | + var menuId = ui.item.find(">a").attr("href"); |
| 34 | + $("#info").text("focus " + menuId); |
| 35 | + }, |
| 36 | + blur: function(event, ui){ |
| 37 | +// alert("blur"); |
| 38 | + $("#info").text(""); |
| 39 | + }, |
| 40 | + select: function(event, ui){ |
| 41 | + var menuId = ui.item.find(">a").attr("href"); |
| 42 | + alert("select " + menuId); |
| 43 | + } |
| 44 | + }); |
| 45 | +}); |
| 46 | +</script> |
| 47 | +</head> |
| 48 | + |
| 49 | +<body class="example"> |
| 50 | + <h1>jquery.contextmenu.js</h1> |
| 51 | + <p><a href="https://github.com/mar10/jquery-contextmenu">View on GitHub</a></p> |
| 52 | + |
| 53 | + |
| 54 | + <div class="menuTargets"> |
| 55 | + <span>Right-click me!</span> |
| 56 | + <span>No, me!</span> |
| 57 | + <span>Me first please!</span> |
| 58 | + </div> |
| 59 | + |
| 60 | + <ul id="splitOptions"> |
| 61 | + <li><a href="#action1">Action 1</a> |
| 62 | + <li><a href="#action2">Action 2</a> |
| 63 | + <li class="ui-state-disabled"><a href="#action3">Action 3</a> |
| 64 | + <li>---- |
| 65 | + <li><a>Extra</a> |
| 66 | + <ul> |
| 67 | + <li><a href="#action4">sub4</a> |
| 68 | + <li><a href="#action5">sub5</a> |
| 69 | + </ul> |
| 70 | + </ul> |
| 71 | + |
| 72 | + <p id="info"></p> |
| 73 | +</body> |
| 74 | +</html> |
0 commit comments