Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.
/ spon-draw Public archive

Off canvas thing... or whatever you want... show/hide a thing

License

Notifications You must be signed in to change notification settings

magicspon/spon-draw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It's an off canvas menu, or sidebar... or something...

Install

npm install spon-draw or yarn add spon-draw

Import

import SponDraw from 'spon-draw'
const mobileMenu = new SponDraw({

  openButton: '[data-menu-opener]',

  overlay: document.getElementById('site-menu'),

  contents: document.getElementById('menu-inner'),

  closeButton: '[data-menu-closer]',

  init: false,

  buttonActiveClass: 'is-active',

  overlayVisibleClass: 'is-visible',

  overlayAnimationClass: 'is-animating',

  transition: true,

  animationType: 'transition',

  before: null
})

Methods

init

mobileMenu.init()

destroy

Remove event listeners, and class names

mobileMenu.destroy()

Events

mobileMenu.on('event', { dom, event })

mobileMenu.on('open',  ({ dom }) => {
	console.log('open', dom)
})

mobileMenu.on('after:open',  ({ dom }) => {
	console.log('after:open', dom)
})

mobileMenu.on('close',  ({ dom }) => {
	console.log('close', dom)
})

mobileMenu.on('after:close',  ({ dom }) => {
	console.log('after:close', dom)
})

About

Off canvas thing... or whatever you want... show/hide a thing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published