|
||||
|
||||
offset(fn)
version 1.4 以降
解説
マッチした最初の要素の、ドキュメントの左上からの相対位置を設定します。 引数
戻り値
関連例
例1:.box をクリックすると、10 ピクセルづつ移動します。 $(".box").click(function() { var box = $(this); box.offset(function(i, coordinates) { var count = box.data("count") || 0; var direction = box.data("direction") || 1; direction = count == 10 ? -1 : count == 0 ? 1 : direction; count = count + direction; box.data("count", count); box.data("direction", direction); return { top: coordinates.top + direction*10, left: coordinates.left + direction*10 }; }); }); |
|
|||
© 2007-2011 by いけまさ. All rights Reserved. |