diff --git a/source/Ox.UI/js/List/List.js b/source/Ox.UI/js/List/List.js index ddcd20f7..86ea3c61 100644 --- a/source/Ox.UI/js/List/List.js +++ b/source/Ox.UI/js/List/List.js @@ -1088,36 +1088,35 @@ Ox.List = function(options, self) { if (self.options.orientation == 'horizontal') { if (self.options.centered) { 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); } else { positions[0] = pos * itemWidth + self.listMargin / 2; positions[1] = positions[0] + itemWidth + self.itemMargin / 2; scroll = that.scrollLeft(); size = getWidth(); + // fixme: css instead of animate(0)? if (positions[0] < scroll || leftOrTopAlign) { - that.animate({ - scrollLeft: positions[0] + 'px' - }, 0); + that.animate({scrollLeft: positions[0] + 'px'}, 0); } else if (positions[1] > scroll + size) { - that.animate({ - scrollLeft: (positions[1] - size) + 'px' - }, 0); + that.animate({scrollLeft: (positions[1] - size) + 'px'}, 0); } } } else { - positions[0] = (self.options.orientation == 'vertical' ? pos : getRow(pos)) * itemHeight; - positions[1] = positions[0] + itemHeight + (self.options.orientation == 'vertical' ? 0 : self.itemMargin); + positions[0] = ( + self.options.orientation == 'vertical' ? pos : getRow(pos) + ) * itemHeight; + positions[1] = positions[0] + itemHeight + ( + self.options.orientation == 'vertical' ? 0 : self.itemMargin + ); scroll = that.scrollTop(); size = getHeight(); + // fixme: css instead of animate(0)? if (positions[0] < scroll || leftOrTopAlign) { - that.animate({ - scrollTop: positions[0] + 'px' - }, 0); + that.animate({scrollTop: positions[0] + 'px'}, 0); } else if (positions[1] > scroll + size) { - that.animate({ - scrollTop: (positions[1] - size) + 'px' - }, 0); + that.animate({scrollTop: (positions[1] - size) + 'px'}, 0); } } }