1.1.3 • Published 2 years ago

h5-floating-menu v1.1.3

Weekly downloads
2
License
ISC
Repository
github
Last release
2 years ago

English | 简体中文

npm version

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

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:

propertydescriptiontypedefault
zIndex'z-index' property in cssnumber11
landscopeModewhether 'landscope' modebooleanfalse
initialLeftinitial location of the menu, 'left'property in cssnumber or string'50%'
initialTopinitial location of the menu, 'top'property in cssnumber or string'50%'
menuItemSizesize of the menu itemstring'50px'
menuItemGapgap size of the menu itemstring'6px'
menuItemBackgroundColorbackground color of the menu itemstring'#fcfcfd'
menuItemTextColorfont color of the menu itemstring'#eaffee'
menuItemTextFontSizefont size of of the menu itemstring'14px'
mainIconClosemain icon of the menu when the menu is foldedstring'<svg ...omitted.../svg>'
mainIconOpenmain icon of the menu when the menu is unfoldedstring'<svg ...omitted.../svg>'
menuItemsmenu itemsobject array{...properties of each object is blow...}

properties of the menuItems is as follows:

propertydescriptiontype
iconicon of the menu itemstring
texttext of the menu itemstring
callbackcallback js script of the menu item after clickingstring. e.g, `console.log('customer service');`

Function

hideWhole()

hide the whole menu.

showWhole()

show the whole menu.

1.1.3

2 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago