jquery-contextify

当前版本: 1.0.8


jquery-contextify是什么?

一个轻量级的jquery插件,用于创建Bootstrap支持的上下文菜单。
A lightweight jQuery plugin for creating Bootstrap powered context menus.

许可协议

GPL-2.0

关键词

jquery , context , menu

安装方式

npm install jquery-contextify@1.0.8

相关网址


jquery-contextify使用说明

jQuery Contextify - Lightweight Context Menu

A lightweight jQuery plugin for creating Bootstrap powered context menus.

Build Status

Setup (安装)

Load from CDN

The easiest way to get up and running is to load jQuery Contextify using a CDN. Make sure jQuery is loaded first though.

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-contextify/1.0.7/jquery.contextify.min.js"></script>

or

<script src="//cdn.jsdelivr.net/jquery.contextify/1.0.7/jquery.contextify.min.js"></script>
Install with Bower (通过Bower安装)

Use the following command to install jQuery Contextify using bower.

$ bower install jquery-contextify

Or simply add jquery-contextify to your project's bower.json.

  "dependencies": {
    "jquery-contextify": "latest"
  }
Download (下载)

You can also just download the latest package.

  • Download latest version
  • or curl -O https://raw.github.com/abeMedia/jquery-contextify/master/dist/jquery.contextify.js

Usage (用法)

jQuery Contextify needs to be activated via JavaScript.

$('.foo').contextify(options);

The menu items are passed as an array in options.items. See the following example for creating a basic context menu.

<a class="foo" href="#" data-name="John">Click me</a>

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-contextify/1.0.7/jquery.contextify.min.js"></script>
<script>
var options = {items:[
  {header: 'Options'},
  {text: 'First Link', href: '#'},
  {text: 'Second Link', onclick: function(e) {
    alert('Hello ' + e.data.name);
  }},
  {divider: true},
  {text: 'Stuff', href: '#'}
]}
$('.foo').contextify(options);
</script>

This will initiate jQuery Contextify on the .foo elements with the menu items specified in options.items.

Options (选项)
Name Type Default Description
items array [] An array of menu item objects.
action string contextmenu The action on which to display the context menu (can be contextmenu, click or mouseover).
menuId string contextify-menu The id attribute of the context menu.
menuClass string dropdown-menu The class attribute of the context menu.
headerClass string dropdown-header The class attribute of menu headers.
dividerClass string divider The class attribute of menu dividers.

Copyright (版权所有)

© 2014-2016 Adam Bouqdib - http://abemedia.co.uk

项目热度

项目信息

分享到

基本信息
开发语言
JavaScript
相关项目
1
相关仓库
1
Watchers
3
Stars
12
Forks
5
版本数量
3
最新发布
2016-10-11
首次发布
2014-10-21
仓库大小
335 KB

版本历史
1.0.8
2016-10-11
1.0.7
2016-08-07
1.0.1
2014-10-21

贡献者
Adam Bouqdib