From 48098219c75305df13f7bc092ac924bf132db623 Mon Sep 17 00:00:00 2001 From: Athou Date: Fri, 17 May 2013 14:35:55 +0200 Subject: [PATCH] always scroll to the element regardless of its visibility for more ux consistency --- src/main/webapp/js/directives.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/webapp/js/directives.js b/src/main/webapp/js/directives.js index 7cc6e0a4..49aa2842 100644 --- a/src/main/webapp/js/directives.js +++ b/src/main/webapp/js/directives.js @@ -138,16 +138,11 @@ 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); }); }); }