Code Monkey home page Code Monkey logo

ctxmenu-javascript's Issues

SVG images cause error

It looks like the _ctxMenusHas function needs tweaked to accommodate SVG images returning something besides the class names. Here's what I tried to fix the issue.

    if (element.className != undefined && element.hasAttribute("class")){ //Added this second condition
        //const classNames = element.className.split(" ");  //Original that seemed to be broken with SVGs
        const classNames = element.getAttribute("class").split(" ");
        for(var i = 0; i < classNames.length; i++) {
            if(this._ctxMenus.has("."+classNames[i])){
                return this._ctxMenus.get("."+classNames[i]);
            }
        }
    }

Method to invoke the context menu

Hi,
Is there a method to call the context menu i created in desired event ..
the scenario is i do something after left click event and i want to invoke the context menu directly when the code on-click finish
so, is there a method to do this .......

Thanks for sharing information

How to get the clicked element

Please correct me if I'm wrong, but the documentation mentions no way get the element that was clicked on. There is, however, a way to get it.

contextMenu.addItem("alertElement", function () {
    alert(contextMenu._elementClicked)
});

I assume the _elementClicked variable is not supposed to be accessed, as it's marked as private. Still, I thought it could be worth mentioning!

addSeparator Issue

Hi, I'm having problems with the addSeparator function.

I haven't modified the script or anything else that caused it to fail

here is the code:

var contextMenu = CtxMenu();

contextMenu.addItem("Clear Advanced Of The Advanced" , icon = "Assets\favicon.ico");
contextMenu.addItem("Options" , icon = "Assets\favicon.ico");
contextMenu.addSeparator();
contextMenu.addItem("Exit" , icon = "Assets\favicon.ico");

it says the function is invalid
what is bad?

[question] multiple context menus

Hi,

I am considering using your contextmenu solution.
On my page, I have multiple list widgets in which I can select items.
I want a context menu for each list widget.
Can I use your solution and if so do you a suggestion how to apply it?

thanks.

Usage Of removeItem

For some cases i must remove some items from menu and add new ones. As i see in your code, there is a removeItem property. How can i use it? For example what is the usage of removeItem if i want to remove the first item from the menu?

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.