Giter VIP home page Giter VIP logo

jsyg.contextmenu's Introduction

JSYG.ContextMenu

ContextMenu plugin originally designed for JSYG framework, but it works as well as a jQuery plugin. Fits well with Bootstrap.

Demo

http://yannickbochatay.github.io/JSYG.ContextMenu/

Installation
npm install jsyg-contextmenu

You can also install it from bower.

Example
//basic Menu
$('html').contextMenu([{
    text:"element 1",
    icon:"fa fa-modx",
    action:function() {
        alert("click on element 1");
    }
},{
    text:"element 2",
    icon:"fa fa-bug",
    action:function() {
        alert("click on element 2");
    }
}]);

//advanced Menu
$('html').contextMenu([{
    text:"simple element",
    icon:"fa fa-modx",
    action:function() {
        alert("click on simple element");
    }
},{
    text:"element with keyboard shortcut",
    shortcut:"k",
    icon:"fa fa-bar-chart",
    action : function(e) {
        alert(e.type+' on element');
    }
},{
    text:"element with global keyboard shortcut",
    icon:"fa fa-bug",
    action : function(e) {
        alert(e.type+' on element');
    },
    globalShortcut:"ctrl+d"
},{
    text:"element with sub-menu",
    icon:"fa fa-book",
    submenu:[{
            text:"disabled element",
            action : function() {
                alert("click on sub-element 1");
            },
            disabled:true,
        },{
            text:"sub-element 2",
            submenu:[{
                    text:"sub-sub-element 1",
                    checkbox:true,
                    action:function(e,val) {
                        alert("checkbox is "+ (val ? '' : 'un') + "checked")
                    }
                },{
                    text:"sub-sub-element 2",
                    action : function() {
                        alert("click on sub-sub-element 2");
                    }
                }]
        }]
},{
    text:"element with submenu and shortcut",
    shortcut:"s",
    submenu:[{
            text:"checkbox element",
            checkbox:true,
            action:function(e,val) {
                alert("checkbox is "+ (val ? '' : 'un') + "checked")
            }
        },{
            text:"sub-sub-element 2",
            action : function() {
                alert("click on sub-sub-element 2");
            }
        }] 
},{
    text:"checkbox element",
    checkbox:true,
    checked:true,
    action:function(e,val) {
        alert("checkbox is "+ (val ? '' : 'un') + "checked")
    }
}]);

jsyg.contextmenu's People

Contributors

yannickbochatay avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.