# h5-floating-menu

> An independent floating menu using native h5, support for drag and configuration.

Latest version **1.1.3** (published 2022-11-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install h5-floating-menu
pnpm add h5-floating-menu
yarn add h5-floating-menu
bun add h5-floating-menu
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2022-11-01 |
| First published | 2019-05-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 63.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | yuancongzhou |
| Maintainers | yuancongzhou |
| Keywords | javascript, h5, floating menu |

## Links

- npm: https://www.npmjs.com/package/h5-floating-menu
- Repository: https://github.com/congzhou09/h5-floating-menu
- Homepage: https://github.com/congzhou09/h5-floating-menu#readme
- Issues: https://github.com/congzhou09/h5-floating-menu/issues
- npm.io page: https://npm.io/package/h5-floating-menu

## Recent versions

- 1.1.3 (latest) — 2022-11-01
- 1.1.2 — 2020-10-19
- 1.1.1 — 2020-10-19
- 1.1.0 — 2019-09-04
- 1.0.7 — 2019-06-11
- 1.0.6 — 2019-06-11
- 1.0.5 — 2019-06-11
- 1.0.4 — 2019-06-03
- 1.0.3 — 2019-05-30
- 1.0.2 — 2019-05-23
- 1.0.1 — 2019-05-21
- 1.0.0 — 2019-05-21

## README

English | [简体中文](https://github.com/congzhou09/h5-floating-menu/blob/HEAD/README_CN.md)

[![npm version](https://badge.fury.io/js/h5-floating-menu.svg)](https://badge.fury.io/js/h5-floating-menu)

### Intro
A common floating H5 menu, independent of any third-part libraries, compatibility with PC Web, showing the text and icon of menu items in a no-blocked way based on the location of the menu, support for drag and configuration.

![autoadaptation demo gif](https://congzhou09.github.io/h5-floating-menu/snapshot/autoadaptation.gif)

### Usage

Download or install via npm (__npm install h5-floating-menu__)
```
// initialization, set the configuration
import H5FloatingMenu from 'h5-floating-menu';
new H5FloatingMenu([_menuConfig_]);
```
Or import via script element:
```
<script src="_path/to/h5-floating-menu.min.js_"></script>
<script>
// initialization, set the configuration
new H5FloatingMenu([_menuConfig_]);
</script>
```

the configuration properties are as follows：

|property|description|type|default|
|:-:|:-:|:-:|:-:|
|zIndex|'z-index' property in css|number|11|
|landscopeMode|whether 'landscope' mode|boolean|false|
|initialLeft|initial location of the menu, 'left'property in css|number or string|'50%'|
|initialTop|initial location of the menu, 'top'property in css|number or string|'50%'|
|menuItemSize|size of the menu item|string|'50px'|
|menuItemGap|gap size of the menu item|string|'6px'|
|menuItemBackgroundColor|background color of the menu item|string|'#fcfcfd'|
|menuItemTextColor|font color of the menu item|string|'#eaffee'|
|menuItemTextFontSize|font size of of the menu item|string|'14px'|
|mainIconClose|main icon of the menu when the menu is folded |string|'<svg ...omitted.../svg>'|
|mainIconOpen|main icon of the menu when the menu is unfolded|string|'<svg ...omitted.../svg>'|
|menuItems|menu items|object array|[{...properties of each object is blow...}]|

properties of the menuItems is as follows：

|property|description|type|
|:-:|:-:|:-:|
|icon|icon of the menu item|string|
|text|text of the menu item|string|
|callback|callback js script of the menu item after clicking|string. e.g, \`console.log('customer service');\`|

### Function

#### hideWhole()
hide the whole menu.

#### showWhole()
show the whole menu.

---
_Source: https://npm.io/package/h5-floating-menu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
