Difference between revisions of "Template:HSNU-TAIPEI/js/nav"

(Created page with "<html> <script> var menu = document.getElementById('main-menu'), showLeft = document.getElementsByClassName('showLeft'), body = document.body; showLeft[0].onclick = fu...")
 
 
(35 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
<script>
 
<script>
  
var menu = document.getElementById('main-menu'),
+
var menu = $("#main-menu"),
     showLeft = document.getElementsByClassName('showLeft'),
+
     showLeft = $(".showLeft"),
     body = document.body;
+
     menuButton = $(".menu-button"),
 +
    secondLayerList = $(".seclayer");
  
 +
function toggleMenu() {
 +
  menu.toggleClass("slide-menu-open");
 +
  menuButton.toggle();
 +
}
 +
 +
showLeft.click(toggleMenu);
 +
 +
secondLayerList.hover(
 +
  function() {
 +
    $(this).children('.seclayer-nav').fadeIn('fast');
 +
  }, function() {
 +
    $(this).children('.seclayer-nav').fadeOut('fast');
 +
  }
 +
);
 +
 +
 +
var nav_bar = $("#top_menu_14");
 +
nav_bar.hide();
 +
$(document).mousemove(function(event) {
 +
  if(event.pageY <= 20) {
 +
    nav_bar.fadeIn();
 +
  } else if(nav_bar.filter(':hover').length === 0) {
 +
    nav_bar.fadeOut();
 +
  }
 +
});
  
showLeft[0].onclick = function() {
 
  menu.classList.toggle('slide-menu-open');
 
};
 
  
 
</script>
 
</script>
 
</html>
 
</html>

Latest revision as of 15:54, 3 April 2015