New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

draggable-menu

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

draggable-menu

Mobile menu with drag functionality resembling native draggable on mobile devices.

unpublished
latest
Source
npmnpm
Version
2.0.4
Version published
Maintainers
1
Created
Source

Draggable Menu

This is a draggable menu web component. It allows you to create a menu that can be dragged out of view as well as toggled in/out.

See demo

Usage

First, import the component:

import 'draggable-menu';

Then you can use it in your HTML:

<draggable-menu
  position="left"
  duration="0.8"
  ease="power2.inOut"
>  
  <!-- Your content here -->
</draggable-menu>

Attributes

nametypedescriptiondefault
placementstring (right | left | top | bottom)The position of the menu in the viewportright
openPositionstring (% or px)The position of the menu in the open state100%
closedPositionstring (% or px)The position of the menu in the closed state0%
durationnumberThe speed of the open/close animation in seconds.0.4
easestringGSAP easing function (see options here)power4.out
enableInertbooleanToggles the inert attribute when the menu is closed/openfalse
handlestringAn element in your slotted content that acts as the drag handle. Defined as a css queryable string (fx. #handle or .handle)undefined

openPosition / closedPosition

A value in percent is calculated as a percentage of the viewport from the placement. A value in pixels will be the value in pixels from the placement.

Examples

/*
  This content would be at 0% from the left of the viewport when closed and
  100% from the left of the viewport when open
  Note that the width of your content also determines how much of it the user will see.
  A width of 100vw would make the entire content visible when open and all of it hidden when closed.
*/
<draggable-menu
  position="left"
  openPosition="100%"
  closedPosition="0%"
>

Events

Every state change is dispatched as a CustomEvent. The event is dispatched on toggle() and drag actions. The event type is DRAGGABLE_MENU_STATE and the event detail is an object with the following properties:

{
  open: boolean, //The current state of the menu, true if open, false if closed
  progress: number //The current progress of the animation from 0 to 1 (o being completey in the closedPosition and 1 being the openPosition,
}

API

The component provides the following methods:

  • toggle(): Toggles the state of the menu. If the menu is open, it will close it, and vice versa.

  • updateValues(): Updates the draggable menu's values.

Keywords

menu

FAQs

Package last updated on 11 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts