jQuery实现右键菜单、遮罩等效果代码(2)

/*mid_right*/ table{ margin-left: 15px; } table tr td{ height: 35px; } table tr td:nth-child(1){ height: 35px; width: 100px; } table tr td:nth-child(2){ height: 35px; width: 390px; } table tr:nth-child(9) td{ height: 100px; padding: 0 50px; } table tr:nth-child(9) .button{ margin-right: 60px; } table tr:nth-child(9) .button:nth-child(3){ margin-right: 0; } table span{ font-size: 14px; color:deepskyblue; } table span.point{ font-size: 14px; color:red; }

**func.js代码(引入主页)**

//鼠标右击菜单 $(window).ready(function() { $('#myMenu').hide(); $('#textbox').bind("contextmenu",function(e){ //显示菜单 $('#myMenu').show(500); //跟随鼠标位置 $('#myMenu').css({ 'top':e.pageY+'px', 'left':e.pageX+'px' }); //屏蔽默认右键菜单 return false; }); });

**main.js代码(引入主页)**

//获得选择的操作名 var check; var checkmenu; var choose = function(){ $("#myMenu ul>li").bind('click',function(){ check = $(this).text(); page(check); }); }; choose(); var page = function(check){ /* //统一样式改变 //右键列表隐藏 $("#myMenu").hide(); //出现遮罩 $("#textbox").after("<div></div>"); checkmenu = 1; windowwidth = $(window).width(); windowheight = $(window).height(); $("#maskbox").css({ 'height': windowheight, 'width': windowwidth }); */ switch (check){ case "管理应用": page_admin(); break; case "添加应用": page_add(); break; case "维护应用账号": page_maintain(); break; case "修改密码": page_modify(); break; case "示例界面": page_test(); break; } }; var page_admin = function(){ console.log("管理应用"); window.location.href="page/page_admin.html"; }; var page_add = function(){ console.log("添加应用"); window.location.href="page/page_add.html"; }; var page_maintain = function(){ console.log("维护应用账号"); window.location.href="page/page_maintain.html"; }; var page_modify = function(){ console.log("修改密码"); window.location.href="page/page_modify.html"; }; var page_test = function(){ console.log("示例界面"); window.location.href="page/page_test.html"; }; //改变屏幕大小时 $(window).resize(function(){ if(checkmenu == 1) { windowwidth = $(window).width(); windowheight = $(window).height(); $("#maskbox").css({ 'height': windowheight, 'width': windowwidth }); } });

**com.js代码**

//统一样式改变 //右键列表隐藏 $("#myMenu").hide(); //出现遮罩 $("#textbox").after("<div></div>"); checkmenu = 1; windowwidth = $(window).width(); windowheight = $(window).height(); $("#maskbox").css({ 'height': windowheight, 'width': windowwidth }); //关闭弹窗 回到主界面 $(".img_close").bind("click",function(){ window.location.href="../index.html"; }); //点击按钮后也回到主界面 $(".save").click(function(){ window.location.href="../index.html"; });

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzjzgw.html