Mango/slideout

Close menu on link click

Deminghuman opened this issue ยท 3 comments

Hi, I'd like the menu to animate back in after clicking a link, with a controllable ease/timing if possible. Is this achievable? I'm pretty new to javascript btw ๐Ÿฅ‰

Thanks in advance- Love the menu!

@Deminghuman

<script src="dist/slideout.min.js"></script>
<script>
  var slideout = new Slideout({
    'panel': document.getElementById('panel'),
    'menu': document.getElementById('menu'),
    'padding': 256,
    'tolerance': 70,
    'easing': 'ease',
  });

  // Toggle button
  document.querySelector('.toggle-button').addEventListener('click', function() {
    slideout.toggle();
  });

  // Close link
  document.querySelectorAll('.link').forEach(item => item.addEventListener('click', event => {
    slideout.close();
  }));
</script>

Wow! Thanks for the quick response and dead-simple, great solution ๐Ÿ‘Œ
Demo of mobile interaction here: http://deminghuman.com/_test

@Deminghuman Was glad to help you.