Skip to content

Latest commit

 

History

History
90 lines (80 loc) · 2.4 KB

README.md

File metadata and controls

90 lines (80 loc) · 2.4 KB

Context.js

Initializing

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

Updating Settings

context.settings({initSettings});

Attaching

context.attach(selector, [menuObjects]);

Destroying

context.destroy(selector);

Menu Object

General option

...
	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;
	}
...

Headers

{
	header: 'My Header Title'
}

Anchor Links

{
	text: 'My Link Title', 
	href: 'http://contextjs.com/', 
	target: '_blank'
}

Dividers

{
	divider: true
}

Event Based Actions

{
    text: 'Event Based Link',
    action: function(e, context){
    	e.preventDefault();
        alert('Do Something');
    }
}

Sub-Menus

{
    text: 'My Sub-menu',
    subMenu: [menuObjects]
}