jquery.contextMenu 鼠标右键
2017-08-04 11:39
127 查看
本文介绍一种网页中实现右键功能的方案–contextMenu。
https://github.com/swisnl/jQuery-contextMenu
下载得到压缩文件jQuery-contextMenu-master.zip
解压后,使用dist目录下css、js。
代码test.html:
下载
下载地址https://github.com/swisnl/jQuery-contextMenu
下载得到压缩文件jQuery-contextMenu-master.zip
解压后,使用dist目录下css、js。
使用方法
使用步骤:(1) 引用css、js。
(2) html、js代码。
简单例子如下:代码test.html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link href="libs/jQuery-contextMenu/dist/jquery.contextMenu.css" rel="stylesheet"/> <script src="libs/jQuery/jquery-1.8.3.min.js"></script> <script src="libs/jQuery-contextMenu/dist/jquery.contextMenu.js"></script> </head> <body> <span class="context-menu-one btn btn-neutral">right click me</span> <script> $(function() { $.contextMenu({ selector: '.context-menu-one', callback: function(key, options) { var m = "clicked: " + key; window.console && console.log(m) || alert(m); }, items: { "edit": {name: "Edit", icon: 4000 "edit"}, "cut": {name: "Cut", icon: "cut"}, copy: {name: "Copy", icon: "copy"}, "paste": {name: "Paste", icon: "paste"}, "delete": {name: "Delete", icon: "delete"}, "sep1": "---------", "quit": {name: "Quit", icon: function(){ return 'context-menu-icon context-menu-icon-quit'; }} } }); $('.context-menu-one').on('click', function(e){ console.log('clicked', this); }) }); </script> </body> </html>
效果
相关文章推荐
- jQuery实现漂亮的指定区域内鼠标右键关联菜单可自定义图标
- (转)js,jQuery屏蔽鼠标右与jquery 鼠标右键事件、左键单击事件判定
- jquery 鼠标右键事件、左键单击事件判定
- 利用jquery实现网页禁止鼠标右键、禁止复制
- Jquery鼠标右键点击弹出菜单
- jquery事件机制扩展插件 jquery鼠标右键事件
- JavaScript oncontextmenu鼠标右键菜单触发 自定义右键菜单示例
- Jquery如何禁止鼠标右键菜单
- JSP----jQuery插件ContextMenu生成右键菜单
- 如何在TabControl中响应右键鼠标(添加一个ContextMenu就可以了),如何让在tab标签处右键菜单和在内容处右键菜单显示不同的菜单?
- jquery 鼠标右键粘帖
- jquery事件机制扩展插件 jquery鼠标右键事件
- JQuery中判断checkbox是否选中与禁用鼠标右键
- JQuery之ContextMenu(右键菜单)
- 深入探讨JavaScript、JQuery屏蔽网页鼠标右键菜单及禁止选择复制
- [ASP.NET 控件实作] 整合 jQuery ContextMenu plugin 的右键选单控件
- 【JQuery】右键菜单插件——contextmenu
- jquery 右键菜单 contextMenu
- 在WPF里面获取右键弹出菜单(ContextMenu)的鼠标点击源(Owner)控件
- jquery实现人性化的有选择性禁用鼠标右键