Skip to content

Instantly share code, notes, and snippets.

@mikehwagz
Created March 21, 2020 22:55
Show Gist options
  • Save mikehwagz/536f0e5e8aea2ef0eb5f0e1f897620b6 to your computer and use it in GitHub Desktop.
Save mikehwagz/536f0e5e8aea2ef0eb5f0e1f897620b6 to your computer and use it in GitHub Desktop.
import { on, add, toggle } from '@/util/dom'
export function toggleVisibilityOnKey(selector, k) {
let el = document.querySelector(selector)
el.style.zIndex = '99999'
add(el, 'dn')
on(window, 'keyup', ({ key }) => {
key === k && toggle(el, 'dn')
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment