Help you create a custom context menu in a specific area.
https://gongpeione.github.io/rightMenu
Add css and js.
<!doctype html>
<html lang="zh_CN">
<head>
<meta charset="UTF-8">
<title>Right Mouse Click Menu</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="RightMenu.js"></script>
<script>
new RightMenu(config);
</script>
</body>
</html>
Configure
{
class: '.rightMenu',
items: [
{
type: 'link',
title: 'Google',
content: 'https://www.google.com',
target: '_blank'
},
{
type: 'separator',
},
{
type: 'function',
title: 'Alert',
content: () => alert(1)
},
{
type: 'link',
title: 'Disabled',
disabled: true
},
{
type: 'text',
title: 'Plain Text',
class: 'plain'
}
]
}
Enjoy.
- 2017/04/10 Rewrite
- 2015/03/14 Create rightMenu.js
MIT licensed
Copyright (C) 2015 Shu, https://geeku.net