jQuery右键菜单contextMenu实例

本文详细介绍了 jQuery ContextMenu 插件的使用方法及配置选项。包括插件的下载地址、参数设置如绑定事件、样式调整等。并提供了实例链接帮助理解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

插件下载地址:
http://www.trendskitchens.co.nz/jquery/contextmenu/jquery.contextmenu.r2.js
压缩版:

http://www.trendskitchens.co.nz/jquery/contextmenu/jquery.contextmenu.r2.packed.js

插件中的参数说明:

Parameters
menu_id
The id of the menu as defined in your markup. You can bind one or more elements to a menu. Eg $("table td").contextMenu("myMenu") will bind the menu with id "myMenu" to all table cells. 
Note: This behaviour has changed from r1 where you needed a "#" before the id 

settings
ContextMenu takes an optional settings object that lets you style your menu and bind click handlers to each option. ContextMenu supports the following properties in the settings object: 

bindings 
An object containing "id":function pairs. The supplied function is the action to be performed when the associated item is clicked. The element that triggered the current menu is passed to this handler as the first parameter. 
Note: This behaviour has changed from r1 where you needed a "#" before the id 
menuStyle 
An object containing styleName:value pairs for styling the containing <ul> menu. 
itemStyle 
An object containing styleName:value pairs for styling the <li> elements. 
itemHoverStyle 
An object containing styleName:value pairs for styling the hover behaviour of <li> elements. 
shadow 
Boolean: display a basic drop shadow on the menu. 
Defaults to true 
eventPosX 
Allows you to define which click event is used to determine where to place the menu. There are possibly times (particularly in IE6) where you will need to set this to "clientX". 
Defaults to: 'pageX' 
eventPosY 
Allows you to define which click event is used to determine where to place the menu. There are possibly times (particularly in IE6) where you will need to set this to "clientY". 
Defaults to: 'pageY' 
onContextMenu(event) 
A custom event function which runs before the context menu is displayed. If the function returns false the menu is not displayed. This allows you to attach the context menu to a large block element (or the entire document) and then filter on right click whether or not the context menu should be shown. 
onShowMenu(event, menu) 
A custom event function which runs before the menu is displayed. It is passed a reference to the menu element and allows you to manipulate the output before the menu is shown. This allows you to hide/show options or anything else you can think of before showing the context menu to the user. This function must return the menu. 


http://www.blogjava.net/supercrsky/articles/250091.html

jQuery右键菜单contextMenu实例

http://www.cnblogs.com/whitewolf/archive/2011/09/28/2194795.html



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值