导航菜单

Bootstrap右键上下文菜单插件

阿里云

jquery-contextify 是一款基于 Bootstrap 的 jQuery 右键上下文菜单插件。该右键菜单使用 Bootstrap 的下拉菜单组件来制作,通过简单的配置即可在指定元素上生成右键菜单。

使用方法:

在页面中引入 Bootstrap 相关文件,jQuery 和 jquery.contextify.min.js 文件。

也想出现在这里?联系我们
创客主机
  1. <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
  2. <script type="text/javascript" src="path/to/jquery.min.js"></script>                  
  3. <script type="text/javascript" src="js/jquery.contextify.min.js.js"></script>

HTML 结构:

以一个超链接为例,右键点击这个超链接可以生成右键菜单。

  1. <a class="foo" href="#" data-name="John">右键点击这里</a>

初始化插件:

在页面 DOM 元素加载完毕之后,可以通过下面的方法来初始化该右键菜单插件。

  1. var options = {items:[
  2.   {header: 'Options'},
  3.   {text: 'First Link', href: '#'},
  4.   {text: 'Second Link', onclick: function(e) {
  5.     alert('Hello ' + e.data.name);
  6.   }},
  7.   {divider: true},
  8.   {text: 'Stuff', href: '#'}
  9. ]}
  10. $('.foo').contextify(options);

配置参数:

jquery-contextify 右键菜单插件的可用配置参数有:

参数 类型 默认值 描述
items array [] 右键菜单项数组对象
action string contextmenu 显示右键菜单的条件,可以是:contextmenuclickmouseover
menuId string contextify-menu 右键菜单的 ID 属性
menuClass string dropdown-menu 右键菜单的 class 属性
headerClass string dropdown-header 右键菜单头部的 class 属性
dividerClass string divider 右键菜单分割线的 class 属性

jquery-contextify 右键菜单的 github 地址为:https://github.com/abeMedia/jquery-contextify

Bootstrap 右键上下文菜单插件

已有 369 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!