1
私は自分のサイトに他の人のスクリプトを適用しています。 MooToolsを使う。私はjQueryを使用します。そのコードには次の行があります。jQuery MooToolsのScroll()。toElementCenter()
new FX.Scroll(window).toElementCenter('obj');
jQueryでこれをどうしますか?あなたはcheck the docs場合
私は自分のサイトに他の人のスクリプトを適用しています。 MooToolsを使う。私はjQueryを使用します。そのコードには次の行があります。jQuery MooToolsのScroll()。toElementCenter()
new FX.Scroll(window).toElementCenter('obj');
jQueryでこれをどうしますか?あなたはcheck the docs場合
はあなたが
new FX.Scroll(window).toElementCenter('obj');
は基本的に意味し、この行を参照してください。
はidを持つ要素の中央に "
obj
"
をアニメーションスクロールを行うと、で実行できるjQueryで
var obj = $('#obj'); // cache the element
$('html, body').animate({
scrollTop: obj.offset() + (obj.height()/2) // scroll to top of element + half of its height
}, 1000); // 1 second fast animation