Last active
June 6, 2020 14:51
-
-
Save nedzen/2746410530aae8f6f96744014c615ae4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var el = document.querySelector('body'); | |
// https://medium.com/@uistephen/keyboardevent-key-for-cross-browser-key-press-check-61dbad0a067a | |
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode | |
document.addEventListener('keyup', function (event) { | |
if (event.defaultPrevented) { | |
return; | |
} | |
var key = event.key || event.keyCode; | |
if (key === 'Escape' || key === 'Esc' || key === 27) { | |
// doWhateverYouWantNowThatYourKeyWasHit(); | |
el.classList.toggle('ds-grid'); | |
} | |
// if (key === 'Space' || key === 'Space' || key === 78) { | |
// // doWhateverYouWantNowThatYourKeyWasHit(); | |
// // el.classList.toggle('ds-grid'); | |
// alert('aaa') | |
// } | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype html | |
html | |
head | |
= partial "partials/meta" | |
= feed_tag :atom, "#{blog('store').options.prefix.to_s}feed.xml", title: "Atom Feed" | |
= javascript_include_tag 'lozad.min.js' | |
= stylesheet_link_tag :app | |
- myclass = current_page.data.bodyclass || 'nothing' | |
body data-barba="wrapper" | |
= partial "partials/header" | |
main class="#{(myclass)}" data-barba="container" data-barba-namespace="page-a" | |
= yield | |
= partial "partials/footer" | |
= partial "partials/ds" if development? | |
= javascript_include_tag 'barba.umd.js' | |
= javascript_include_tag 'chocolat.js' | |
= javascript_include_tag 'all.js' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment