Browse Source

Fixed potential performance bottleneck

Tobias Reich 8 years ago
parent
commit
9a53ab5615
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/scripts/view.js

+ 4 - 4
src/scripts/view.js

@@ -143,10 +143,6 @@ view.album = {
 
 			var photosData = '';
 
-			// Save and reset scroll position
-			view.albums.content.scrollPosition = $(document).scrollTop();
-			$('html, body').scrollTop(0);
-
 			if (album.json.content&&album.json.content!==false) {
 
 				// Build photos
@@ -156,6 +152,10 @@ view.album = {
 
 			}
 
+			// Save and reset scroll position
+			view.albums.content.scrollPosition = $(document).scrollTop();
+			requestAnimationFrame(() => $(document).scrollTop(0));
+
 			// Add photos to view
 			lychee.content.html(photosData);