右键点击菜单
$("#content-wrapper")[0].scrollTop = 700; var kyoPopupMenu={}; kyoPopupMenu = (function(){ return { sys: function (obj) { $('.popup_menu').remove(); popupMenuApp = $('<div class="popup_menu app-menu"><ul><li><a menu="menu1">跳转1</a></li><li><a menu="menu2">跳转2</a></li></ul></div>') .find('a').attr('href','javascript:;') .end().appendTo('body'); //绑定事件 $('.app-menu a[menu="menu1"]').on('click', function (){ //window.location.href=""; alert('menu1'); }); return popupMenuApp; } }})(); $("body").mouseup(function(){ $('.popup_menu').remove(); }); //取消右键 $('html').on('contextmenu', function (){return false;}).click(function(){ $('.popup_menu').hide(); }); //桌面点击右击 $('body').on('contextmenu',function (e){ var popupmenu = kyoPopupMenu.sys(); l = ($(document).width() - e.clientX) < popupmenu.width() ? (e.clientX - popupmenu.width()) : e.clientX; t = ($(document).height() - e.clientY) < popupmenu.height() ? (e.clientY - popupmenu.height()) : e.clientY; popupmenu.css({left: l,top: t}).show(); return false; });
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。