]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use body element when animating scroll in public page
authorVincent Petry <pvince81@owncloud.com>
Wed, 15 Oct 2014 08:14:20 +0000 (10:14 +0200)
committerVincent Petry <pvince81@owncloud.com>
Wed, 15 Oct 2014 08:53:25 +0000 (10:53 +0200)
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.

Backport of 704ffaa6a37730f02a3359e8e8f0a0070f0e0d31 from master

apps/files/js/filelist.js

index 34d4885cdce7792ef747914d093a782562ccd101..d08e77f5a5accfc990ea104dba536e167b979196 100644 (file)
 
                        // Animation
                        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
                                scrollTop: currentOffset + $fileRow.offset().top - $fileRow.height() * 2 - additionalOffset
                        }, {