I want to implement a context menu in my page. The script is working good, but Now I'd like open a modal when I do click some seccion from context menu.
I have the following HTML:
<!-- Body -->
<div id="contextMenu" class="content right-click">
</div>
and jQuery code:
<!-- Context Menu (Right Click) -->
<script src="../../plugins/contextMenu/js/contextmenu.min.js"></script>
<script type="text/javascript">
var $div = $('#contextMenu');
// ContextMenu instance
var cm = new ContextMenu({
selector: '.right-click',
callback: function(cmd, options) {
switch (cmd) {
case 'SetLayer':
$div[0].style.backgroundColor = 'red';break;
case 'SetProjection':
$div[0].style.backgroundColor = 'blue';break;
}
},
items: [
{
text: 'Set Map',
items: [
{
text: 'Set Layer',
cmd: 'SetLayer',
target: '_blank',
url: ''
}, {
text: 'Set Projection',
cmd: 'SetProjection',
target: '_blank',
url: ''
}
]
}
]
});
</script>
I've tried to insert the following jQuery code into 'SetProjection':
$('#projectionModal').dialog('open');break;
But without-success.
By the way, when I do click on SetLayer or SetProjection I can change the BackGroundColor.