Menu de contexto com JQuery
|
Categoria: Javascript
|
Publicado em 28 de Novembro de 2010
|
Exemplo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Context Menu Plugin Demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="jquery.contextMenu.js" type="text/javascript"></script>
<link href="jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready( function() {
// Show menu when a list item is clicked
$("#myList UL LI").contextMenu({
menu: 'myMenu'
}, function(action, el, pos) {
alert(
'Action: ' + action + '\n\n' +
'Element text: ' +$(el).attr('id')
);
});
});
</script>
</head>
<body>
<div id="myList">
<ul>
<li id="1">Item 1</li>
<li id="2">Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
</ul>
</div>
<ul id="myMenu" class="contextMenu">
<li class="edit"><a href="#edit">Editar</a></li>
<li class="cut separator"><a href="#cut">Colar</a></li>
<li class="copy"><a href="#copy">Copiar</a></li>
<li class="paste"><a href="#paste">Colar</a></li>
<li class="delete"><a href="#delete">Deletar</a></li>
<li class="quit separator"><a href="#quit">Sair</a></li>
</ul>
</body>
</html>
|
Os 3 arquivos incluídos podem ser baixados de:
|