Script.js 542 B

123456789101112131415161718192021222324
  1. function moveMenuSelector(menuItem) {
  2. var offset = menuItem.offset();
  3. $("#menuselector").width(menuItem.width());
  4. $("#menuselector").offset(offset);
  5. $("nav ul li").find("a").css("color", "#337ab7");
  6. menuItem.find("a").css("color", "white");
  7. }
  8. $(document).ready(function() {
  9. $("#menuselector").height($("#menuselector").parent().height());
  10. $("nav ul li").mouseenter(function() {
  11. moveMenuSelector($(this));
  12. });
  13. $("nav ul li").mouseleave(function() {
  14. moveMenuSelector($(".active"));
  15. });
  16. moveMenuSelector($(".active"));
  17. });