What is the best way to implement a menu for web in a list mode?
What I have:
What I need:
image for reference:
requirements:
the menu must work in a list view mode. I tried some implementation with popovers that didn't allow to select one of the menu items because when the mouse went down on the screen it activated another popover;
the menu must allow for buttons inside as well as input text areas.
the menu must be positioned in the right side of the screen or wherever the person right-clicks with a mouse. This is important because clicking the list has a specific function (other then displaying the menu). So, I have to allow the action to be performed or the menu to be displayed. My idea was left-click / right-click or left side of the item minus 20 pixels and 20 pixels in the right.
ideally, it would also be:
accessed on hovering the right end of the item, and allowing the user to move the mouse down and access each menu until he finds the correct. Something like when there is a sidemenu with submenus in (just the same feel, as it is not the same context applied);
not having the tooltip / arrow of a popover would be better. If impossible, it could at least be arranged correctly in direction with the object to hover. I learned that in object too much to the right or left the tooltip / arrow doesn't adjust itself, but remains centered to the menu width.
better if less dependencies. I prefer just HTML, just HTML or CSS, just HTML, CSS and Javascript or, if impossible, just HTML, CSS, Javascript, jQuery and jQuery plugins. But, as usual, the simpler the better.
My list is based a lot of divs (for each item) inside another div (for the right side of the window). There is also, like a finder window, a left side menu based on a div with float left. (just saying that because better more info than less).
I do not have a working code yet for the menu. Actually, I'm not sure how to start. I tried some stackoverflow answers but none seems to fit my purpose. I'm unsure if I should dive in bootstrap, x-editable or anything else.
I've made a Mac OS X like content menu here:
You can't really make a context menu without JavaScript. There is an object called funcs
if you scroll down in the JavaScript. Each item is HTML like:
<item action="">HTML Code for Menu Item</item>
There is also a state
tag you can apply to gray something out:
<item state="gray">Grayed out item</item>
The attribute action
will let the item run JavaScript when you click it:
<item action="run">Run Code!</item>
then you make a function run
in funcs
:
var funcs = {
"run": function () {
alert('Code!');
}
};
Now when you click that item. It will alert Code!
. In each item, you can put whatever HTML, and you can run whatever code.
This will allow you to right click anywhere to get the context menu. It will allow you to put whatever code you want, uses jQuery only without plugins, and is generally pretty simple. I modeled this after OS X Yosemite's popover, I even sampled colors directly.
This version you can add exit='noclick'
and that specific item won't make the thing disappear.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.