0

このコードを使用すると

$("#mainMenu .home").hover(
  function () {
      $("#mainMenuHoverTitle").fadeIn("fast");
      $("#mainMenuHoverTitle").css("background-position", "440px 600px");
      $("#mainMenuHoverTitle").text("Naslovna");
  },
  function () {
      $("#mainMenuHoverTitle").hide();
  }
);
$("#mainMenu .alarm").hover(
  function () {
      $("#mainMenuHoverTitle").fadeIn("fast");
      $("#mainMenuHoverTitle").css("background-position", "440px 583px");
      $("#mainMenuHoverTitle").text("Alarm (9)");
  },
  function () {
      $("#mainMenuHoverTitle").hide();
  }
);

動かなくなったメニューをマウスですばやく移動します。それを行う方法は適切ですか?

4

1 に答える 1

1

.stop()現在のアニメーションをキャンセルするには、アニメーションの前に追加する必要があります。

$("#mainMenu .home").hover(
  function () {
      $("#mainMenuHoverTitle").stop().fadeIn("fast");
      $("#mainMenuHoverTitle").css("background-position", "440px 600px");
      $("#mainMenuHoverTitle").text("Naslovna");
  },
  function () {
      $("#mainMenuHoverTitle").stop().hide();
  }
);
$("#mainMenu .alarm").hover(
  function () {
      $("#mainMenuHoverTitle").stop().fadeIn("fast");
      $("#mainMenuHoverTitle").css("background-position", "440px 583px");
      $("#mainMenuHoverTitle").text("Alarm (9)");
  },
  function () {
      $("#mainMenuHoverTitle").stop().hide();
  }
);
于 2013-08-14T14:06:43.983 に答える