stop() before animate()

This commit is contained in:
rolux 2011-05-28 00:06:56 +02:00
parent 8e6df3d054
commit 2c82f51120

View file

@ -779,10 +779,10 @@ Ox.Calendar = function(options, self) {
var delta = (date - self.options.date) / 1000 * getPixelsPerSecond(), var delta = (date - self.options.date) / 1000 * getPixelsPerSecond(),
// 250 ms for half the width of the visible area // 250 ms for half the width of the visible area
ms = 250 * Math.min(Math.abs(delta) / (self.$content.width() / 2), 1); ms = 250 * Math.min(Math.abs(delta) / (self.$content.width() / 2), 1);
self.$scalebar.animate({ self.$scalebar.stop().animate({
marginLeft: -delta + 'px' marginLeft: -delta + 'px'
}, ms); }, ms);
self.$content.animate({ self.$content.stop().animate({
marginLeft: -delta + 'px' marginLeft: -delta + 'px'
}, ms, function() { }, ms, function() {
self.$scalebar.stop().css({marginLeft: 0}); self.$scalebar.stop().css({marginLeft: 0});
@ -791,7 +791,7 @@ Ox.Calendar = function(options, self) {
self.options.date = date; self.options.date = date;
renderCalendar(); renderCalendar();
}); });
self.$scrollbar.animate({ self.$scrollbar.stop().animate({
marginLeft: -delta / getScrollbarFactor() + 'px' marginLeft: -delta / getScrollbarFactor() + 'px'
}, ms); }, ms);
if (!Ox.isUndefined(line)) { if (!Ox.isUndefined(line)) {
@ -964,7 +964,7 @@ Ox.Calendar = function(options, self) {
delta = top - scrollTop, delta = top - scrollTop,
ms = 250 * Math.min(Math.abs(delta) / (containerHeight / 2), 1); ms = 250 * Math.min(Math.abs(delta) / (containerHeight / 2), 1);
if (animate) { if (animate) {
self.$container.animate({ self.$container.stop().animate({
scrollTop: top scrollTop: top
}, ms); }, ms);
} else { } else {