js+css实现带缓冲效果右键弹出菜单

4周前 (04-15 16:49)阅读35回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4494
  • 级别管理员
  • 主题898
  • 回复2
楼主

js+css实现右击鼠标弹出菜单特效,这个弹出菜单特效带缓冲效果,兼容性还不错,根据自己的需求来自定义。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>js+css实现带缓冲效果右键弹出菜单_武鸣人</title>
<style type="text/css">
div,body,span,ul,li {padding:0;margin:0;font-size:12px;}
ul,ol {list-style-type:none;}
#wuming_ren {width:196px;height:296px;padding:2px;overflow:hidden;position:absolute;border:1px solid #666;left:200px;top:50px;display:none;z-index=1;-webkit-box-shadow:1px 3px 4px #888;box-shadow:1px 3px 4px #888;-moz-box-shadow:1px 3px 4px #888;}
#wuming li {width:176px;height:25px;line-height:25px;cursor:pointer;overflow:hidden;padding-left:20px;}
.www_wuming_ren {width:500px;height:25px;font-size:20px;margin:50px 200px;color:red;}
</style>
<script type="text/javascript">
var g_wuming_ren={};
var oDiv=null;
var g_iSpeed=0;
var t=null;
window.onload=function(){
opUl();
oDiv=document.getElementById("wuming_ren");
oDiv.style.height="0px";
document.oncontextmenu=function(ev){
var oEvent=window.event||ev;
cancelDefault(oEvent);
g_wuming_ren.MouseX=oEvent.clientX;
g_wuming_ren.MouseY=oEvent.clientY;
oDiv.style.left=g_wuming_ren.MouseX+"px";
oDiv.style.top=g_wuming_ren.MouseY+"px";
/* 初始化经过背景为空 */
var oUl=document.getElementById("wuming");
var aLi=oUl.getElementsByTagName("li");
for(var i=0;i<aLi.length;i++){
aLi[i].style.background="none";
}
clearInterval(t);
doDiv();
}
document.body.onmousedown=function(ev){
var oEvent=window.event||ev;
clearInterval(t);
g_iSpeed=0;
g_wuming_ren.h=0;
oDiv.style.height=g_wuming_ren.h+"px";
oDiv.style.display="none";
}
oDiv.onmousedown=function(ev){
var oEvent=window.event||ev;
oEvent.cancelBubble=true;
}
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
function doDiv(ev){
var oEvent=window.event||ev;
oDiv.style.display="block";
t=setInterval(doMove,30);
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
function doMove(){
if(oDiv.offsetHeight>=302){
g_iSpeed*=-0.7;
oDiv.style.height=302+"px";
}
g_wuming_ren.h=g_iSpeed+oDiv.offsetHeight;
g_iSpeed+=10;
oDiv.style.height=g_wuming_ren.h+"px";
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
function cancelDefault(oEvent){
if(oEvent.preventDefault){
oEvent.preventDefault();
}
else{
oEvent.returnValue=false;
}
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
/* 对li操作后的动作的定义 */
function opUl(){
var oUl=document.getElementById("wuming");
var aLi=oUl.getElementsByTagName("li");
for(var i=0;i<aLi.length;i++){
aLi[i].aIndex=i;
aLi[i].onmouseover=function(){
for(j=0;j<aLi.length;j++){
aLi[j].style.background="none";
}
aLi[this.aIndex].style.background="#ffbb66";
}
aLi[i].onclick=function(){
clearInterval(t);
oDiv.style.display="none";
alert(this.innerHTML+" 你可以在这里自定义自己的方法啦");
}
}
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
</script>
</head>
<body style="width:2000px;height:800px;">
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div class="www_wuming_ren">武鸣人提示您:右键点击鼠标看效果</div>
<div id="wuming_ren">
<ul id="wuming">
<li><a href="https://www.wuming.ren" target="_blank">武鸣人一号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人二号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人三号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人四号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人五号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人六号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人七号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人八号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人九号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人十号菜单</a></li>
<li><a href="https://www.wuming.ren" target="_blank">武鸣人十一号菜单</a></li>
<li><a href="https://wuming.ren" target="_blank">武鸣人十二号菜单</a></li>
</ul>
</div>
</body>
</html>


0
0
收藏0
回帖

js+css实现带缓冲效果右键弹出菜单 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息