Difference between revisions of "Template:SJTU-BioX-Shanghai/Alpha/Header"

Line 3: Line 3:
 
<script>
 
<script>
 
function hide_nav_click(btn) {
 
function hide_nav_click(btn) {
  alert('hide')
+
   btn.onclick = function(){show_nav_click(this)}
   btn.onclick = function(){console.log(this)}
+
 
   var nav = btn.parentNode;
 
   var nav = btn.parentNode;
 
   var svg = btn.firstChild;
 
   var svg = btn.firstChild;
Line 10: Line 9:
 
   svg.transform.baseVal[0].matrix.a = -1
 
   svg.transform.baseVal[0].matrix.a = -1
 
   svg.transform.baseVal[0].matrix.e = 10
 
   svg.transform.baseVal[0].matrix.e = 10
   console.log(svg)
+
}
 +
function show_nav_click(btn) {
 +
   btn.onclick = function(){show_nav_click(this)}
 +
  var nav = btn.parentNode;
 +
  var svg = btn.firstChild;
 +
  nav.classList.remove('nav-hided')
 +
  svg.transform.baseVal[0].matrix.a = 1
 +
  svg.transform.baseVal[0].matrix.e = 0
 
}
 
}
 
</script>
 
</script>

Revision as of 01:29, 11 August 2015