I'm looking to implement a Toggle button with snap.js from the following source: https://github.com/jakiestfu/Snap.js. The usage instructions on the website are quite concise and I'm struggling to grasp them. Below is the code I've put together so far. I'm a beginner in javascript, so any guidance would be greatly appreciated.
<script src="js/snap.min.js"></script>
<script>
var snapper = new Snap({
element: document.getElementById('content')
});
myToggleButton.addEventListener('click', function(){
if( snapper.state().state=="left" ){
snapper.close();
} else {
snapper.open('left');
}
});
</script>
</head>
<body>
<button id="myToggleButton">Menu</button>
<div id="content">
This is a menu
</div>