title: Animate Javascript classList.toggle
body: <p>I recently started to learn CSS and HTML and found <a href="http://www.w3schools.com/howto/howto_js_topnav.asp" rel="nofollow">this</a> tutorial for a responsive navbar.</p>
  
  <p>They show the mobile version of the navbar with the javascript function classList.toggle. Is there any way to animate this and add a transition?</p>
  
  <pre><code>function myFunction() {
  document.getElementsByClassName("topnav")[0].classList.toggle("responsive");}
  </code></pre>