simplify animateScroll a little
This commit is contained in:
parent
621c7c3dc8
commit
fb2be29d5e
2 changed files with 35 additions and 38 deletions
|
|
@ -757,18 +757,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (center)
|
||||
offset -= this.$size.scrollerHeight / 2;
|
||||
|
||||
if (animate !== false) {
|
||||
this.animateScrolling(function() {
|
||||
this.session.setScrollTop(offset);
|
||||
}, this, callback);
|
||||
} else {
|
||||
this.session.setScrollTop(offset);
|
||||
}
|
||||
var initialScroll = this.scrollTop;
|
||||
this.session.setScrollTop(offset);
|
||||
if (animate !== false)
|
||||
this.animateScrolling(initialScroll, callback);
|
||||
};
|
||||
|
||||
this.animateScrolling = function(scrollFunc, self, callback) {
|
||||
var fromValue = this.scrollTop;
|
||||
scrollFunc.call(self);
|
||||
this.animateScrolling = function(fromValue, callback) {
|
||||
var toValue = this.scrollTop;
|
||||
if (this.$animatedScroll && Math.abs(fromValue - toValue) < 100000) {
|
||||
var _self = this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue