context.init({
fadeSpeed: 100,
filter: function ($obj){},
above: 'auto',
preventDoubleContext: true,
compress: false
});
Parameter | Type | Default | Description |
---|---|---|---|
fadeSpeed | int | 100 | The speed in which the context menu fades in (in ms) |
filter | function | null | Function that each finished list element will pass through for extra modification |
above | string | boolean | |
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 unobstrutive |
context.settings({initSettings});
context.attach(selector, [menuObjects]);
context.destroy(selector);
...
onBeforeShow: function(context, menuObject){
if(menuObject.text == "Foo"){
// if the current menuObject has the text foo it will not be displayed
return false;
}
return true;
}
...
{
header: 'My Header Title'
}
{
text: 'My Link Title',
href: 'http://contextjs.com/',
target: '_blank'
}
{
divider: true
}
{
text: 'Event Based Link',
action: function(e, context){
e.preventDefault();
alert('Do Something');
}
}
{
text: 'My Sub-menu',
subMenu: [menuObjects]
}