ax5ui / ax5ui-menu

Javascript UI Component - Menu (Context Menu, Inline Menu)
http://ax5.io/ax5ui-menu/demo/index.html
MIT License
21 stars 2 forks source link

Item on Click #1

Closed creaturerigger closed 8 years ago

creaturerigger commented 8 years ago

I am trying to find how to create item on click function out but i could not what am i missing? Can you please give an example how to do it? I tried something like this:

menu.onLoad = function(){
        $(this).find("[data-menu-item-index]").on('click', function(){            
            var index = $(this).getAttribute("data-menu-item-index");
            if(index == 0){
                do something....
            }
            else if(index == 1){
                do another thing
            }
            else if(index ==2){
                do etc...
            }
        });
    };
creaturerigger commented 8 years ago

I went to console and found menu's classes and attributes then i composed this and it works well eventhough i still don't have any idea if there is a menuitem.onclick function.:

$('div.ax5-ui-menu').find('.ax-menu-item, .ax-menu-item-html').on('click', function () { var index = $(this).attr('data-menu-item-index'); switch(index){ case "0": do something; break; case "1": do something else; break; . . . . default: break; } });

brant-hwang commented 8 years ago

duplicated. https://github.com/ax5ui/ax5ui-kernel/issues