Web Component: j-Menu
j-Menu
- jComponent
v19|v20
- easy usage for different cases
- works with touches
- supports Dark mode
- singleton
- NEW supports large mode
Configuration:
- NEW
style
{Number}
changes style (supported style2
(default) and1
)
Usage
var opt = {};
// opt.offsetX {Number} : adds X offset (default: 0)
// opt.offsetY {Number} : adds Y offset (default: 0)
// opt.align {String} : align `left` (default), `center` or `right`
// opt.position {String} : position `top` (default) or `bottom`
// opt.hide {Function} : is executed when the menu is hidden
// opt.class {String} : adds class to the parent
// opt.large {Boolean} : it will make menu bigger
// opt.fixedwidth {Boolean} : NEW: enables fixed width according to the target element
// opt.offsetWidth {Number} : increases width of the menu
// opt.nomobile {Boolean} : change size on mobile screen
opt.element = YOUR_ELEMENT;
// or if you want to use a fixed position:
// opt.x {Number} : `x` position
// opt.y {Number} : `y` position
opt.items = ['Label', { name: 'Item 1', icon: 'print', class: 'custom_class_name' }, { name: 'Item 2', icon: 'home', note: 'A simple description for this item' }, '-', { name: 'Item 3', icon: 'ti ti-envelope', children: [{ name: 'Submenu item 1', icon: 'cog' }, { name: 'Submenu item 2', icon: 'home' }] }, { name: 'Selected', icon: 'check-circle', selected: true }, { name: 'Item 4', icon: 'gear', disabled: true }];
// Item properties
// name {String} : Item name
// icon {String} : Icon
// class {String} : class to be added to li element
// note {String} : text bellow Item name
// selected {Boolean} : item will be highlighted
// disabled {Boolean} : item will be disabled(not clickable)
// children {Array} : array of subitems
// color {String} : icon color
opt.callback = function(item) {
console.log(item);
};
SETTER('menu', 'show', opt);
Author
- Peter Širka petersirka@gmail.com
- License
Created
17. august 2018
Updated
22. july 2024
jComponent library
19 | 20
Version
v1
License
https://www.totaljs.com/license/
Dark mode
Yes
Large mode
Yes
Responsive
Yes
Author
Peter Širka
Email
petersirka@gmail.com