-5

何が悪いのかわかりません、助けてください。

jQuery アニメーションは元に戻りません。

リンク: http://extreme-network.tk/

コード:

$(window).load(function () {
   $('#footer').hover(function () {
         $(this).stop().animate({
             top: "444px"
         }, 500);
     }, function () {
         var width = $(this).height() - 32;
         $(this).stop().animate({
             bottom: -height
         }, 500);
   });
 });
4

1 に答える 1

1

代わりに、var width = $(this).height() -32;あなたが欲しいと思いますvar height = $(this).height() - 32;

$(window).load(function(){
    $('#footer').hover(function () {
        $(this).stop().animate({top:"444px"},500);     
    },function () {
        var height = $(this).height() -32;
        $(this).stop().animate({bottom: - height  },500);     
    });
});

また、コードを簡素化できます。

$('#footer').hover(function () {
    $(this).stop().animate({top:"440px"}, 500);     
}, function () {
    $(this).stop().animate({top: "494px" },500);     
});

JSFIDDLE デモ | JSFIDDLE コード

于 2013-06-23T12:54:03.853 に答える