console
var sidebarMotion={
toggleEl: document.getElementById("toggle"),
sidebarEl: document.getElementsByClassName("sidebar")[0],
init: function(){
this.toggleEl.addEventListener("click", this.clickHandle.bind(this), false);
},
clickHandle: function(){
console.log(this);
this.showSidebar();
},
showSidebar: function(){
this.sidebarEl.style.display = "block";
}
}
sidebarMotion.init();
<button type="button" id="toggle">click</button>
<div class="sidebar"></div>
.sidebar {
height: 20px;
width: 20px;
background-color: #222;
display: none;
}