阻止右击事件并更改为自定义导航栏;
<script>
document.oncontextmenu=function(){ return false };
</script>
2.
<div id="menu">
<p> <a href="category.php">现货商城</a></p>
<p><a href="article_cat.php?id=19">资讯报价</a></p>
<p><a href="zhifa.php">钢厂直发</a></p>
<p><a href="BuyingHall.php">求购大厅</a></p>
<p><a href="jiagong.php">加工服务</a></p>
</div>
<script>
var oMenu = document.getElementById('menu');
document.oncontextmenu = function(ev){
var oEvent = ev || window.event;
oMenu.style.display = 'block';
oMenu.style.left = oEvent.clientX + 'px';
oMenu.style.top = oEvent.clientY + 'px';
return false;
}
document.onclick = function(){
oMenu.style.display = 'none';
}
</script>
3.
#menu {
display: none;
position: absolute;
width: 160px;
box-shadow: 0 8px 16px rgba(0, 0, 0, .1);
background-color: rgba(0,0,8px,0.1);
background:#fff;
z-index:999999999;
font-size:16px;
border-radius:4px 6px;
}
#menu p{
padding: 4px;
line-height:40px;
height:40px;
text-align:center;
cursor:pointer;
}
#menu p:hover a{
color:#159AE5;
margin-left:10px;
transition:all 0.5s;
text-decoration:underline;
}
#menu p a{
color:#333;
font-size:16px;
transition:all 0.5s;
}