後で関数を呼び出したときにアイテムがアニメーション化されるように、この動きをアニメーション化するにはどうすればよいですか? 私は通常使用します$(this).animate
が、位置を計算しているため、これをラップする方法がわかりません。ありがとう。
jQuery.fn.center = function ()
{
this.css("position","absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
$(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
$(window).scrollLeft()) + "px");
return this;
}