From 53dfc904c5169c1cb4a9ca984632fee12d8c5492 Mon Sep 17 00:00:00 2001 From: Athou Date: Tue, 4 Jun 2013 22:13:15 +0200 Subject: [PATCH] always scroll to entry regardless of visibility, as google reader does --- src/main/webapp/js/directives.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/webapp/js/directives.js b/src/main/webapp/js/directives.js index 98fa3783..638c9c4b 100644 --- a/src/main/webapp/js/directives.js +++ b/src/main/webapp/js/directives.js @@ -140,16 +140,12 @@ module.directive('scrollTo', [ '$timeout', function($timeout) { var elemTop = $(element).offset().top; var elemBottom = elemTop + $(element).height(); - if ((elemTop > docTop) && (elemBottom < docBottom)) { - // element is entirely visible - return; - } else { - var offset = parseInt(attrs.scrollToOffset, 10); - var scrollTop = $(element).offset().top + offset; - $('html, body').animate({ - scrollTop : scrollTop - }, 0); - } + var offset = parseInt(attrs.scrollToOffset, 10); + var scrollTop = $(element).offset().top + offset; + $('html, body').animate({ + scrollTop : scrollTop + }, 0); + }); }); }