Pixel-perfect OS-style javascr

Contextmenu is a javascript library (with no dependencies) that allows the creation of native-looking right-click menus within a web page.

Don't use this in an attempt to replace the default context menu (e.g., to prevent Download Linked File As..., Save Image As..) because that is very annoying. The intended use is really for javascript-heavy web apps.

Screenshots

Mac OS X Lion Style

Windows Vista Style

Windows 7 Style

Ubuntu Style

Fallback Style

Usage

Requirements:

contextmenu.js contextmenu.css

Either specify the markup using HTML context-menu notation HTML Spec, or use the simple Javascript API provided by the contextmenu object which builds DOM nodes, and adds some javascript to ensure browser compatibility.

API Example

var menu = contextmenu([ { label: "First Item", onclick: function (e){ document.body.style.background = "green"; } }, { label: "Sub menu", children: [ { label: "Another Item" } ] } ]); // Hook up an event to launch it contextmenu.attach(domNode, menu); //Or Show menu directly contextmenu.show(menu, 300, 200); Sites using Contextmenu Graph.tk

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。