Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aside-drawer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aside-drawer

drawer helps to make web component like android drawer aside view

  • 0.8.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

drawer helps to make web component like android drawer aside view.

up down left right every side drawer library.

How to Use

this is simple. first you should to hide your aside or other view by translateX or Y.

<style>
aside {
    top:0;
    left:0;
    width: 230px;
    height: 100vh;
    position: fixed;
    transform: translateX(-100%);
    background: #444;
}
</style>
<aside></aside>
const drawer = new Drawer({
    element: document.querySelector('aside')
})

Properties

changeCallback

called whenever drawer's percent degree changed. first parameter will be percent.

{
    changeCallback: (percent) => {
        console.log(percent)
    }
}

and percent is 100 or 0, it means open or close.

allowToDirectSpread

set rull that can be control open drawer by user. if it is false, user cant open drawer when drawer have been closed.

restoringPercentage

it is meaningful when property allowToDirectSpread property is true. also you can manipulate fix percentage of drawer. its default value is 40. it mean drawer will be open only when user tug until 40% of screen of cellphone.

openAllowPixel

it is meaningful when property allowToDirectSpread property is true. when drawer closed state, user can open the drawer within openAllowPixel degree. in other words, it can be opened only in inner code.

Notice

changeCallback property guide

normally u dont need to match the delay with drawer. because it is unnecessary considering the performance degradation.

DEMO

Keywords

FAQs

Package last updated on 30 Jan 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc