Context.js 右键菜单
ContextJS is a lightweight solution for contextual menus. Currently, there are two versions.
The first is to be used with Twitters Bootstrap (bootstrap.css specifically). If you do not use or want to use bootstrap.css, there is a standalone stylesheet to give the menu it's base styles.
Features
- Linted: Valid JS
- Can be used with or without Twitters Bootstrap.css
- Event Based Links
- Anchor Links
- Headers
- Dividers
- Recursive Menus (infinite depth)
- Vertical Space Detection (turns into a "dropup")
- Horizontal Space Detection (Drops to the left instead of right)
- Add/Delete menus Dynamically
在线实例
使用方法
- context.init({
- fadeSpeed: 100,
- filter: function ($obj){},
- above: 'auto',
- preventDoubleContext: true,
- compress: false
- });
Headers
- {
- header: 'My Header Title'
- }
Anchor Links
- {
- text: 'My Link Title',
- href: 'http://contextjs.com/',
- target: '_blank'
- }
Dividers
- {
- divider: true
- }
Event Based Actions
- {
- text: 'Event Based Link',
- action: function(e){
- e.preventDefault();
- alert('Do Something');
- }
- }
Sub-Menus
- {
- text: 'My Sub-menu',
- subMenu: [menuObjects]
- }
Tracking Links with Google Analytics
- {
- text: 'context.js',
- href: 'http://contextjs.com/context.js',
- target:'_blank',
- action: function(e){
- _gaq.push(['_trackEvent', 'ContextJS Download', this.pathname, this.innerHTML]);
- }
- }
参数详解
| Paramater | Type | Default | Description |
|---|---|---|---|
| fadeSpeed | int | 100 | The speed in which the context menu fades in (in milliseconds) |
| filter | function | null | Function that each finished list element will pass through for extra modification. |
| above | string || boolean | 'auto' | If set to 'auto', menu will appear as a "dropup" if there is not enough room below it. Settings to true will make the menu a "popup" by default. |
| preventDoubleContext | boolean | true | If set to true, browser-based context menus will not work on contextjs menus. |
| compress | boolean | false | If set to true, context menus will have less padding, making them (hopefully) more unobtrusive |
Updating Settings
- context.settings({initSettings});
| Paramater | Type | Default | Description |
|---|---|---|---|
| settings | object | null | The init settings can be placed in here to update context menus written to the DOM. Changing settings between attaching menus will give the menus their own options. |
Attaching
- context.attach('#download', [menuObjects]);
| Paramater | Type | Default | Description |
|---|---|---|---|
| selector | string | null | The jQuery (or css) selector of the element you want to apply the context menu to |
| menuObjects | array | null | An array of objects that define the menus structure |
Destroying
- context.destroy('#download');
| Paramater | Type | Default | Description |
|---|---|---|---|
| selector | string | null | The jQuery (or css) selector of the element you want to remove the context menu from |
Context.js 右键菜单的更多相关文章
- js 右键菜单
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- ASP.NET Boilerplate 学习 AspNet Core2 浏览器缓存使用 c#基础,单线程,跨线程访问和线程带参数 wpf 禁用启用webbroswer右键菜单 EF Core 2.0使用MsSql/MySql实现DB First和Code First ASP.NET Core部署到Windows IIS QRCode.js:使用 JavaScript 生成
ASP.NET Boilerplate 学习 1.在http://www.aspnetboilerplate.com/Templates 网站下载ABP模版 2.解压后打开解决方案,解决方案目录: ...
- JS组件系列——Bootstrap右键菜单解决方案:ContextMenu
前言:有段时间没发表随笔了,过个年人都变得懒了.新年刚来上班,今天正好得空,将去年遗留的两个小组件总结记录下.有朋友跟我说:你的bootstrap组件要能够形成一个可以满足一般项目需求的系列组件,才有 ...
- js屏蔽浏览器右键菜单,粘贴,复制,剪切,选中(转)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- js实现自定义右键菜单--兼容IE、Firefox、Chrome
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <hea ...
- 关于FlexPaper 2.1.2版本 二次开发 Logo 、打印、搜索、缩略图、添加按钮、js交互、右键菜单、书签等相关问题
2015-03-02 更新文章,由于需求修改,更改了flexpaper插件,故增加第9.10.11小节,下载代码时请注意. 先废话几句.最近用到文档在线浏览功能,之前用的是print2flash(一个 ...
- js禁止页面复制 禁用页面右键菜单的代码
js实现禁止页面复制功能.禁用页面右键菜单等功能. <body oncontextmenu="return false">禁用网页右键菜单,但是仍然可以使用快捷键复制 ...
- js禁止默认的右键菜单或出现自定义右键菜单
1.屏蔽默认的右键菜单 js: document.getElementById('myimg').oncontextmenu=function(){return false;} jquery: $(' ...
- 禁止页面复制功能 js禁止复制 禁用页面右键菜单
<body oncontextmenu="return false">禁用网页右键菜单,但是仍然可以使用快捷键复制. js代码禁用复制功能: <script t ...
随机推荐
- Oracle 11g系列:SQL Plus与PL/SQL
SQL Plus是Oracle提供的一种用户接口,是数据库与用户之间进行交互的工具. PL/SQL是Oracle的过程化编程语言. 1.登录SQL Plus 利用Windows的[开始]|[运行]命令 ...
- IO流-ZIP文档
java中通常使用ZipInputStream来读ZIP文档 ZIP文档(通常)以压缩格式存储了一个或多个文件,每个ZIP文档都有一个包含诸如文件 名字和所使用的压缩方法等信息的头.在Java中,可以 ...
- java中匿名类的注意细节
abstract class Outer{ int num; public Outer(int x){ num = x; } public abstract void show1(); public ...
- python--爬虫入门(八)体验HTMLParser解析网页,网页抓取解析整合练习
python系列均基于python3.4环境 基本概念 html.parser的核心是HTMLParser类.工作的流程是:当你feed给它一个类似HTML格式的字符串时,它会调用goahead方法 ...
- [c++] Iterators
性质depends on various containers. 需要躲过的坑,野指针. int main() { cout << "Hello World!" < ...
- WebStorm 9 配置 Live Edit 功能与浏览器实现同步
1. 打开Chrome浏览器,点击右上角的“自定义及控制”按钮,选择“更多工具”-->”扩展程序”,打开“扩展程序”页面. 其实以上步骤可以简化为:用Chrome打开chrome://exten ...
- Linux rsync实现断点续传
Linux 主机之间即时传送文件,scp命令大家都很熟悉但当要传送的文件较大,过程中如果网络中断了,就比较悲剧了.这时候可以考虑使用rsync命令替代scp,实现断点续传文件. 试验:rsync使用 ...
- Windows Azure HandBook (7) 基于Azure Web App的企业官网改造
<Windows Azure Platform 系列文章目录> 1.用户场景: C公司是全球大型跨国连锁餐厅,在世界上大约拥有3万间分店.其IT系统主要部署其海外数据中心,或者租用其他ID ...
- ASP.NET MVC必知必会知识点总结(二)
一.实现Controller的依赖注入: 1.自定义继承DefaultControllerFactory 类的控制器工厂类并重写GetControllerInstance方法:(如:InjectCon ...
- 十年微软(Microsoft)MVP
十年微软(Microsoft)MVP,七月一日收到邮件,今早收到从美国微软寄过来的证书!