您的位置:首页 > Web前端 > JQuery

jQuery右键菜单contextMenu实例

2013-01-23 11:56 639 查看
插件下载地址:
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: