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

 
(22 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
var menu = $("#main-menu"),
 
var menu = $("#main-menu"),
 
     showLeft = $(".showLeft"),
 
     showLeft = $(".showLeft"),
     menuButton = $(".menu-button");
+
     menuButton = $(".menu-button"),
 +
    secondLayerList = $(".seclayer");
  
 
function toggleMenu() {
 
function toggleMenu() {
Line 13: Line 14:
 
showLeft.click(toggleMenu);
 
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"), lastLessThan = false;
+
 
 +
var nav_bar = $("#top_menu_14");
 
nav_bar.hide();
 
nav_bar.hide();
 
$(document).mousemove(function(event) {
 
$(document).mousemove(function(event) {
   if(event.pageY <= 20 && lastLessThan === false) {
+
   if(event.pageY <= 20) {
 
     nav_bar.fadeIn();
 
     nav_bar.fadeIn();
    lastLessThan = true;
+
   } else if(nav_bar.filter(':hover').length === 0) {
   } else {
+
    nav_bar.fadeOut();
    nav_bar.mouseleave(function() {
+
      lastLessThan = false;
+
      $(this).fadeOut();
+
    });
+
 
   }
 
   }
 
});
 
});
 
  
  
 
</script>
 
</script>
 
</html>
 
</html>

Latest revision as of 15:54, 3 April 2015