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

Line 16: Line 16:
 
var nav_bar = $("#top_menu_14");
 
var nav_bar = $("#top_menu_14");
 
nav_bar.hide();
 
nav_bar.hide();
nav_bar.hover(function() {
 
  this.data('hover',1); //store in that element that the mouse is over it
 
}, function() {
 
  this.data('hover',0); //store in that element that the mouse is no longer over it
 
});
 
function isOnNavBar() { return nav_bar.data('hover'); }
 
 
$(document).mousemove(function(event) {
 
$(document).mousemove(function(event) {
   if(event.pageY <= 20 || isOnNavBar()) {
+
   if(event.pageY <= 20) {
 
     nav_bar.fadeIn();
 
     nav_bar.fadeIn();
  } else {
 
    nav_bar.fadeOut();
 
 
   }
 
   }
 
});
 
});
 +
 +
nav_bar.hover(
 +
  function() {
 +
    $(this).show();
 +
  }, function() {
 +
    $(this).fadeOut();
 +
  }
 +
);
  
  
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 14:13, 3 April 2015