<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>点击鼠标右键显示自定义菜单</title>
<style type="text/css">
*{ margin: 0; padding: 0;}
ul{ list-style: none; background:#FFFF00; width: 50px; height: 50px;}
.box{ float: left; width: 100px; height:100px; background:#007AFF; margin:5px; position: relative;}
.con{ position:absolute; left:60px; top:60px;}
</style>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
</head>
<body oncontextmenu="return false" onselectstart="return false">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<script type="text/javascript">
$(function(){
var boxs=$('.box');
boxs.mousedown(function(){
if(event.button==2){
var con=$("<ul class='con'><li>内容</li></ul>");
$(this).append(con);
}
})
boxs.mouseleave(function(){
$('.con').remove();
})
})
</script>
</body>
</html>
打开App,阅读手记