あなたの質問のさまざまな解釈を見るのは興味深いことです。垂直方向に配置することを考えるとき、私は Adobe Illustrator を思い浮かべます。選択した多数の図形を均等に配置する方法です。そのために、次のようなことができます。
注: これは、個々の高さに関係なく、要素間の均等なギャップを維持するために簡単に適応できます。
$('.align').click(function() {
// Cache the elements
var $obj = $('.obj');
// Sort them by offset top
$obj = $obj.sort(function(a, b) {
return $(a).offset().top - $(b).offset().top;
});
// Get get the offset of the first and last elements
// NOTE that we included the last element's height... you may need to tweak it
// here due to CSS borders adding to the height
var firstOffsetTop = $obj.first().offset().top;
var lastOffsetTop = $obj.last().offset().top + $obj.last().height();
// The new container height is the difference between the first,
// and last element's position
var containerHeight = lastOffsetTop - firstOffsetTop;
// Determine the gap between each element, based on the height of the container
// divided by the number of elements
var spacing = containerHeight / $obj.length;
// Assign top properties
$obj.each(function(i, el) {
$(this).css('top', (i * spacing) + firstOffsetTop + 'px');
});
});