0
  1. マウスオーバーで div を表示するページがあります。ページをフォーカス時に div に移動させたいのですが...

今、私は div への onfocus をイージング プラグインと一緒に移動して移動したいと考えています。アニメイトで「遅い」を使いたくない

$('html, body').animate({ scrollTop: $('#box0').offset().top }, 1000);

上記のコードにイージングを適用するにはどうすればよいですか

次に、表示されている div を mouseenter で左から右にスライドさせ、右から左にスライドさせてから非表示にします。これは私が今のところ使用しているものです。私が今していることを達成するためのより良い、または最良の方法があることを私は知っています。

$("#app0").mouseenter(function () {
 $("#lSection2").show('slide').delay(3000); //container for div of four 
 $("#boxContent0").slideDown(2000);$('html, body').animate({ scrollTop: $('#app0').offset().top }, 1000);// one of the divs within #lSection2

}); 

$('#boxContent0').mouseleave(function() {
    $("#boxContent0").fadeOut(1000);     
    $("#lSection2").fadeOut(1000);
});

ご協力いただきありがとうございます

4

1 に答える 1

1

イージングは​​次のように追加できます。http://api.jquery.com/animate/を参照してください。

.animate( properties [, duration] [, easing] [, complete] )

mouseover とのホバーを使用できますmouseout

$("#app0").hover(function () {
     // Mouseover
     $("#lSection2").stop(true, false).width(0).animate({ width: 200}, 1000);
},function(){
     // Mouseout
     $("#lSection2").stop(true, false).width(0).animate({ width: 0}, 1000);
});

そうしないと、マウスオーバー、マウスアウトで最初のアニメーションが完了し、次のアニメーション、次のアニメーション、次のアニメーションが完了するため、アニメーションを停止して次のアニメーションを続行できます。

于 2011-11-15T15:00:22.613 に答える