title: Edge Swipe Navigation
body: <p>Can you recommend a JS library that actually <strong>provides</strong> edge swipe functionality when working with bare-bones HTML &amp; CSS?</p>
  
  <p>I've searched all over and haven't found a source of truth for that problem.
  I've seen lots and lots of libraries enabling swipe gestures but not edge swipe.</p>
  
  <p>My last attempt was using <em>Hammer.js</em> which I've tried implementing as: </p>
  
  <pre><code>var swipe = new Hammer(document);
  // detect swipe and call to a function
  swipe.on('swiperight swipeleft', function (e) {
      e.preventDefault();
      var endPoint = e.pointers[0].pageX;
      var distance = e.distance;
      var origin = endPoint - distance;
  
      //swipe right to open nav
      if (origin &lt;= 15 &amp;&amp; e.type == 'swiperight') {
          // open main menu
          $('#navigation-menu').animate({
              left: '0'
          });
      } else {
          // close/hide menu(s)
          $('#navigation-menu').animate({
              left: '-100%'
          });
      }
  });
  </code></pre>
  
  <p>Further, if not using any library, <strong>how can I implement a mobile edge swipe to show and hide content, (in my case it'd be a navigation menu)</strong> with vanilla JS?</p>
  
  <p>At this point I'm open to either solution/direction.</p>