Skip to content

mrothenbuecher/Context.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]
}

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 60.3%
  • CSS 28.0%
  • HTML 11.7%