minor reformatting

This commit is contained in:
rolux 2012-06-30 11:18:55 +02:00
parent 28b9614083
commit 91275f7171

View file

@ -1088,36 +1088,35 @@ Ox.List = function(options, self) {
if (self.options.orientation == 'horizontal') { if (self.options.orientation == 'horizontal') {
if (self.options.centered) { if (self.options.centered) {
that.animate({ that.animate({
scrollLeft: (self.listMargin / 2 + (pos + 0.5) * itemWidth - that.width() / 2) + 'px' scrollLeft: self.listMargin / 2 + (pos + 0.5) * itemWidth
- that.width() / 2 + 'px'
}, 250); }, 250);
} else { } else {
positions[0] = pos * itemWidth + self.listMargin / 2; positions[0] = pos * itemWidth + self.listMargin / 2;
positions[1] = positions[0] + itemWidth + self.itemMargin / 2; positions[1] = positions[0] + itemWidth + self.itemMargin / 2;
scroll = that.scrollLeft(); scroll = that.scrollLeft();
size = getWidth(); size = getWidth();
// fixme: css instead of animate(0)?
if (positions[0] < scroll || leftOrTopAlign) { if (positions[0] < scroll || leftOrTopAlign) {
that.animate({ that.animate({scrollLeft: positions[0] + 'px'}, 0);
scrollLeft: positions[0] + 'px'
}, 0);
} else if (positions[1] > scroll + size) { } else if (positions[1] > scroll + size) {
that.animate({ that.animate({scrollLeft: (positions[1] - size) + 'px'}, 0);
scrollLeft: (positions[1] - size) + 'px'
}, 0);
} }
} }
} else { } else {
positions[0] = (self.options.orientation == 'vertical' ? pos : getRow(pos)) * itemHeight; positions[0] = (
positions[1] = positions[0] + itemHeight + (self.options.orientation == 'vertical' ? 0 : self.itemMargin); self.options.orientation == 'vertical' ? pos : getRow(pos)
) * itemHeight;
positions[1] = positions[0] + itemHeight + (
self.options.orientation == 'vertical' ? 0 : self.itemMargin
);
scroll = that.scrollTop(); scroll = that.scrollTop();
size = getHeight(); size = getHeight();
// fixme: css instead of animate(0)?
if (positions[0] < scroll || leftOrTopAlign) { if (positions[0] < scroll || leftOrTopAlign) {
that.animate({ that.animate({scrollTop: positions[0] + 'px'}, 0);
scrollTop: positions[0] + 'px'
}, 0);
} else if (positions[1] > scroll + size) { } else if (positions[1] > scroll + size) {
that.animate({ that.animate({scrollTop: (positions[1] - size) + 'px'}, 0);
scrollTop: (positions[1] - size) + 'px'
}, 0);
} }
} }
} }