mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 08:54:10 +00:00
feature(menu) v0.6.0
This commit is contained in:
parent
3525935b9a
commit
04b7ac5426
4 changed files with 34 additions and 9 deletions
|
|
@ -24,29 +24,47 @@ Tired to use js based libraries which use jquery and `.hover` classes insteed of
|
|||
Create `html` page with `js` and `css` connected.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="http://coderaiser.github.io/menu/menu.min.css">
|
||||
<script src="http://coderaiser.github.io/menu/menu.min.js"></script>
|
||||
<link rel="stylesheet" href="http://coderaiser.github.io/menu-io/menu.min.css">
|
||||
<script src="http://coderaiser.github.io/menu-io/menu.min.js"></script>
|
||||
```
|
||||
|
||||
Add little JavaScript:
|
||||
|
||||
```js
|
||||
var menu = Menu({
|
||||
var menu = MenuIO({
|
||||
'item name': function onItemNameClick() {
|
||||
}
|
||||
}
|
||||
```
|
||||
You could use element and (or) options parameters if you need to.
|
||||
|
||||
```js
|
||||
var element = document.body,
|
||||
|
||||
options = {
|
||||
icon : true, /* add class icon-item-name */
|
||||
beforeClose : alert,
|
||||
beforeShow : alert,
|
||||
beforeClick : alert,
|
||||
name : 'name of menu' /* if you want use a couple menu on one element */
|
||||
},
|
||||
|
||||
menu = Menu(element, options, {
|
||||
'item name': function onItemNameClick() {
|
||||
});
|
||||
```
|
||||
|
||||
Look for `examples` directory or copy example from bottom:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="http://coderaiser.github.io/menu/menu.min.css">
|
||||
<script src="http://coderaiser.github.io/menu/menu.min.js"></script>
|
||||
<link rel="stylesheet" href="http://coderaiser.github.io/menu-io/menu.min.css">
|
||||
<script src="http://coderaiser.github.io/menu-io/menu-io.min.js"></script>
|
||||
<script>
|
||||
window.addEventListener('load', function onLoad() {
|
||||
'use strict';
|
||||
|
||||
window.removeEventListener('load', onLoad);
|
||||
var menu = Menu({
|
||||
var menu = MenuIO({
|
||||
help: function() {
|
||||
alert('*help');
|
||||
},
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
list-style : none;
|
||||
|
||||
color : #222;
|
||||
|
||||
background : rgb(255,255,255);
|
||||
background : rgba(255,255,255, 0.9);
|
||||
|
||||
|
|
|
|||
|
|
@ -206,12 +206,17 @@ var MenuIO, Util;
|
|||
function showMenuElement(x, y) {
|
||||
var beforeShow = Options.beforeShow,
|
||||
name = Options.name,
|
||||
params = {
|
||||
x : x,
|
||||
y : y,
|
||||
name : name
|
||||
},
|
||||
|
||||
notShow = Util.exec(beforeShow, x, y, name);
|
||||
notShow = Util.exec(beforeShow, params);
|
||||
|
||||
if (!notShow) {
|
||||
ElementMenu.classList.remove('menu-hidden');
|
||||
setMenuPosition(x, y);
|
||||
setMenuPosition(params.x, params.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "menu",
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.0",
|
||||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
||||
"description": "Simple css-based multillevel context menu",
|
||||
"homepage": "http://coderaiser.github.io/menu",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue