HTML5自定义右键菜单

/*====================== 自定义右键菜单 ======================*/
$("#log_list").on("contextmenu","p[class='log']",function(ev) {
	selectFileName = $(this).attr("fileName");
	 var oEvent = ev || event;
	 //自定义的菜单显示
        var menu = document.getElementById("opration");
	 menu.style.display = "block";
	 //让自定义菜单随鼠标的箭头位置移动
	 menu.style.left = oEvent.clientX + "px";
	 menu.style.top = oEvent.clientY + "px";
	 //return false阻止系统自带的菜单,
	 //return false必须写在最后,否则自定义的右键菜单也不会出现
	 return false;  
	
});

你可能感兴趣的:(JavaScript)