Use body element when animating scroll in public page

In the public page the scroll container is the window instead of a div.
The $(window) object doesn't support animating the scroll property, so
the $('body') element is used instead.
This commit is contained in:
Vincent Petry 2014-10-15 10:14:20 +02:00
parent 3b3affa1ef
commit 704ffaa6a3
1 changed files with 7 additions and 1 deletions

View File

@ -1919,7 +1919,13 @@
// Animation // Animation
var _this = this; var _this = this;
this.$container.animate({ var $scrollContainer = this.$container;
if ($scrollContainer[0] === window) {
// need to use "body" to animate scrolling
// when the scroll container is the window
$scrollContainer = $('body');
}
$scrollContainer.animate({
// Scrolling to the top of the new element // Scrolling to the top of the new element
scrollTop: currentOffset + $fileRow.offset().top - $fileRow.height() * 2 - additionalOffset scrollTop: currentOffset + $fileRow.offset().top - $fileRow.height() * 2 - additionalOffset
}, { }, {