Facebook
From ja, 3 Years ago, written in HTML5.
This paste is a reply to Untitled from Stained Pheasant - view diff
Embed
Download Paste or View Raw
Hits: 68
  1.  
  2. let isOpen = false;
  3.  
  4. $('body').click(function() {
  5.   if (isOpen) {
  6.         isOpen = false;
  7.     return;
  8.   }
  9.   hideDrawer();
  10. });
  11.  
  12. function hideDrawer() {
  13.   $('#drawer').css('transform', 'translateY(-100%)');
  14. }
  15.  
  16. $('#menu').click(function() {
  17.   isOpen = true;
  18.   showDrawer();
  19. })
  20.        
  21. function showDrawer() {
  22.   $('#drawer').css('transform', 'translateY(0)');
  23. }