Close menu on link click
Deminghuman opened this issue ยท 3 comments
Deminghuman commented
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!
9585999 commented
<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>
Deminghuman commented
Wow! Thanks for the quick response and dead-simple, great solution ๐
Demo of mobile interaction here: http://deminghuman.com/_test
9585999 commented
@Deminghuman Was glad to help you.